@xmtp/node-sdk 6.2.0-dev.999b077 → 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/README.md +27 -8
- package/dist/index.d.ts +1740 -1630
- package/dist/index.js +2974 -2806
- package/dist/index.js.map +1 -1
- package/package.json +45 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
declare const ApiUrls: {
|
|
16
|
-
readonly local: "http://localhost:5556";
|
|
17
|
-
readonly dev: "https://grpc.dev.xmtp.network:443";
|
|
18
|
-
readonly production: "https://grpc.production.xmtp.network:443";
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Pre-configured URLs for the XMTP history sync service based on the environment
|
|
22
|
-
*
|
|
23
|
-
* @constant
|
|
24
|
-
* @property {string} local - The local URL for the XMTP history sync service
|
|
25
|
-
* @property {string} dev - The development URL for the XMTP history sync service
|
|
26
|
-
* @property {string} production - The production URL for the XMTP history sync service
|
|
27
|
-
*/
|
|
28
|
-
declare const HistorySyncUrls: {
|
|
29
|
-
readonly local: "http://localhost:5558";
|
|
30
|
-
readonly dev: "https://message-history.dev.ephemera.network";
|
|
31
|
-
readonly production: "https://message-history.production.ephemera.network";
|
|
32
|
-
readonly "testnet-staging": "https://message-history.dev.ephemera.network";
|
|
33
|
-
readonly "testnet-dev": "https://message-history.dev.ephemera.network";
|
|
34
|
-
readonly testnet: "https://message-history.dev.ephemera.network";
|
|
35
|
-
readonly mainnet: "https://message-history.production.ephemera.network";
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
declare class CodecRegistry {
|
|
39
|
-
#private;
|
|
40
|
-
constructor(codecs: ContentCodec[]);
|
|
41
|
-
/**
|
|
42
|
-
* Gets the codec for a given content type
|
|
43
|
-
*
|
|
44
|
-
* @param contentType - The content type to get the codec for
|
|
45
|
-
* @returns The codec, if found
|
|
46
|
-
*/
|
|
47
|
-
getCodec<ContentType = unknown>(contentType: ContentTypeId): ContentCodec<ContentType> | undefined;
|
|
1
|
+
import { Action, ActionStyle, Actions, Actions as Actions$1, ApiStats, AppDataChange, AppDataChange as AppDataChange$1, ArchiveMetadata, ArchiveMetadata as ArchiveMetadata$1, ArchiveOptions, ArchiveOptions as ArchiveOptions$1, Attachment, Attachment as Attachment$1, AuthConfiguration, Backend, Backend as Backend$1, BackendBuilder, BackupElementSelectionOption, Client as Client$1, Consent, Consent as Consent$1, ConsentEntityType, ConsentEntityType as ConsentEntityType$1, ConsentState, ConsentState as ConsentState$1, ContentType, ContentTypeId, Conversation as Conversation$1, ConversationDebugInfo, ConversationListItem, ConversationType, ConversationType as ConversationType$1, Conversations as Conversations$1, CreateDmOptions, CreateDmOptions as CreateDmOptions$1, CreateGroupOptions, CreateGroupOptions as CreateGroupOptions$1, Cursor, DecodedMessage as DecodedMessage$1, DeletedMessage, DeliveryCursor, DeliveryCursor as DeliveryCursor$1, DeliveryStatus, DeliveryStatus as DeliveryStatus$1, EncodedContent, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMessageKind as GroupMessageKind$1, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupSyncSummary as GroupSyncSummary$1, GroupUpdated, GroupUpdated as GroupUpdated$1, HmacKey, Identifier, Identifier as Identifier$1, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, Intent as Intent$1, KeyPackageStatus, LeaveRequest, LeaveRequest as LeaveRequest$1, Lifetime, LimitsConfiguration, ListConversationsOptions, ListConversationsOptions as ListConversationsOptions$1, ListConversationsOrderBy, ListMessagesOptions, ListMessagesOptions as ListMessagesOptions$1, LogLevel, LogLevel as LogLevel$1, LogOptions, Message, Message as Message$1, MessageCatchUp, MessageCatchUp as MessageCatchUp$1, MessageCatchUpGeneration, MessageDisappearingSettings, MessageHistorySnapshot, MessageSortBy, MessageTopicStatus, MetadataField, MetadataField as MetadataField$1, MetadataFieldChange, MlsConfiguration, MultiRemoteAttachment, MultiRemoteAttachment as MultiRemoteAttachment$1, NotificationOverride as NotificationOverride$1, PermissionLevel, PermissionPolicy, PermissionPolicy as PermissionPolicy$1, PermissionPolicySet, PermissionUpdateType, PermissionUpdateType as PermissionUpdateType$1, Reaction, Reaction as Reaction$1, ReactionAction, ReactionSchema, ReadReceipt, ReadReceipt as ReadReceipt$1, RemoteAttachment, RemoteAttachment as RemoteAttachment$1, Reply, Reply as Reply$1, RetentionConfiguration, SendMessageOpts, SendMessageOpts as SendMessageOpts$1, SendOpts, SendOpts as SendOpts$1, ServerConfiguration, ServerConfiguration as ServerConfiguration$1, SignatureRequestHandle, SignatureRequestHandle as SignatureRequestHandle$1, SigningKeyDescription, SortDirection, StreamCloser, TransactionMetadata, TransactionReference, TransactionReference as TransactionReference$1, UserPreferenceUpdate, UserPreferenceUpdate as UserPreferenceUpdate$1, VisibilityConfirmationOptions, VisibilityConfirmationOptions as VisibilityConfirmationOptions$1, WalletCall, WalletSendCalls, WalletSendCalls as WalletSendCalls$1, WorkerConfigOptions, WorkerConfigOptions as WorkerConfigOptions$1, WorkerIntervalOverride, WorkerJitterOverride, WorkerKind, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, flushTelemetry, initLogging } from "@xmtp/node-bindings";
|
|
2
|
+
import { ContentCodec, ContentTypeId as ContentTypeId$1 } from "@xmtp/content-type-primitives";
|
|
3
|
+
//#region src/CodecRegistry.d.ts
|
|
4
|
+
export declare class CodecRegistry {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(codecs: ContentCodec[]);
|
|
7
|
+
/**
|
|
8
|
+
* Gets the codec for a given content type
|
|
9
|
+
*
|
|
10
|
+
* @param contentType - The content type to get the codec for
|
|
11
|
+
* @returns The codec, if found
|
|
12
|
+
*/
|
|
13
|
+
getCodec<ContentType = unknown>(contentType: ContentTypeId$1): ContentCodec<ContentType> | undefined;
|
|
48
14
|
}
|
|
49
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/DecodedMessage.d.ts
|
|
50
17
|
/**
|
|
51
18
|
* Represents a decoded XMTP message
|
|
52
19
|
*
|
|
@@ -66,210 +33,201 @@ declare class CodecRegistry {
|
|
|
66
33
|
* @property {Date} sentAt - Timestamp when the message was sent
|
|
67
34
|
* @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
68
35
|
*/
|
|
69
|
-
declare class DecodedMessage<ContentTypes = unknown> {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
36
|
+
export declare class DecodedMessage<ContentTypes = unknown> {
|
|
37
|
+
/** Database-local position of this delivery. Absent for ordinary history reads. */
|
|
38
|
+
deliveryCursor?: DeliveryCursor$1;
|
|
39
|
+
content: ContentTypes | undefined;
|
|
40
|
+
contentType: ContentTypeId;
|
|
41
|
+
conversationId: string;
|
|
42
|
+
deliveryStatus: DeliveryStatus$1;
|
|
43
|
+
expiresAtNs?: bigint;
|
|
44
|
+
expiresAt?: Date;
|
|
45
|
+
fallback?: string;
|
|
46
|
+
id: string;
|
|
47
|
+
kind: GroupMessageKind$1;
|
|
48
|
+
numReplies: number;
|
|
49
|
+
reactions: DecodedMessage<Reaction$1>[];
|
|
50
|
+
senderInboxId: string;
|
|
51
|
+
sentAt: Date;
|
|
52
|
+
sentAtNs: bigint;
|
|
53
|
+
constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
|
|
85
54
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
declare function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*/
|
|
94
|
-
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/utils/validation.d.ts
|
|
57
|
+
export type HexString = `0x${string}`;
|
|
58
|
+
export declare function isHexString(value: unknown): value is HexString;
|
|
59
|
+
export declare function validHex(value: unknown): HexString;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types.d.ts
|
|
95
62
|
/**
|
|
96
63
|
* Network options
|
|
97
64
|
*/
|
|
65
|
+
/** A backend credential. Include the `Bearer ` prefix when required. */
|
|
66
|
+
type Credential = {
|
|
67
|
+
/** Header name. Defaults to `authorization`. */
|
|
68
|
+
name?: string;
|
|
69
|
+
value: string;
|
|
70
|
+
/** Expiration as Unix seconds. Must be a safe integer. */
|
|
71
|
+
expiresAtSeconds: number;
|
|
72
|
+
};
|
|
73
|
+
/** Called when the backend needs a credential, including credential refresh. */
|
|
74
|
+
type AuthCallback = () => Promise<Credential>;
|
|
98
75
|
type NetworkOptions = {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* specific endpoint
|
|
108
|
-
*/
|
|
109
|
-
apiUrl?: string;
|
|
110
|
-
/**
|
|
111
|
-
* The host of the XMTP Gateway for your application
|
|
112
|
-
*
|
|
113
|
-
* Only valid for `dev` and `production` environments
|
|
114
|
-
*
|
|
115
|
-
* @see https://docs.xmtp.org/fund-agents-apps/run-gateway
|
|
116
|
-
*/
|
|
117
|
-
gatewayHost?: string;
|
|
118
|
-
/**
|
|
119
|
-
* Custom app version
|
|
120
|
-
*/
|
|
121
|
-
appVersion?: string;
|
|
76
|
+
/** Backend URL, including the HTTP or HTTPS scheme. */
|
|
77
|
+
backendUrl: string;
|
|
78
|
+
/** Label used only for the default database file name. */
|
|
79
|
+
env?: string;
|
|
80
|
+
/** Custom app version. */
|
|
81
|
+
appVersion?: string;
|
|
82
|
+
/** Supply backend credentials. Separate from the XMTP identity signer. */
|
|
83
|
+
authCallback?: AuthCallback;
|
|
122
84
|
};
|
|
123
85
|
/**
|
|
124
86
|
* Device sync options
|
|
125
87
|
*/
|
|
126
88
|
type DeviceSyncOptions = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* @see https://docs.xmtp.org/chat-apps/list-stream-sync/history-sync
|
|
132
|
-
*/
|
|
133
|
-
historySyncUrl?: string | null;
|
|
134
|
-
/**
|
|
135
|
-
* Disable device sync
|
|
136
|
-
*/
|
|
137
|
-
disableDeviceSync?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Disable device sync
|
|
91
|
+
*/
|
|
92
|
+
disableDeviceSync?: boolean;
|
|
138
93
|
};
|
|
139
94
|
/**
|
|
140
95
|
* Storage options
|
|
141
96
|
*/
|
|
142
97
|
type StorageOptions = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Path to the local DB
|
|
100
|
+
*
|
|
101
|
+
* There are 4 value types that can be used to specify the database path:
|
|
102
|
+
*
|
|
103
|
+
* - `undefined` (or excluded from the client options)
|
|
104
|
+
* The database will be created in the current working directory and is based on
|
|
105
|
+
* the environment label and client inbox ID.
|
|
106
|
+
* Example: `xmtp-default-<inbox-id>.db3`
|
|
107
|
+
*
|
|
108
|
+
* - `null`
|
|
109
|
+
* No database will be created and all data will be lost once the client disconnects.
|
|
110
|
+
*
|
|
111
|
+
* - `string`
|
|
112
|
+
* The given path will be used to create the database.
|
|
113
|
+
* Example: `./my-db.db3`
|
|
114
|
+
*
|
|
115
|
+
* - `function`
|
|
116
|
+
* A callback function that receives the inbox ID and returns a string path.
|
|
117
|
+
* Example: `(inboxId) => string`
|
|
118
|
+
*/
|
|
119
|
+
dbPath?: string | null | ((inboxId: string) => string);
|
|
120
|
+
/**
|
|
121
|
+
* Encryption key for the local DB (32 bytes, hex)
|
|
122
|
+
*
|
|
123
|
+
* @see https://docs.xmtp.org/sdk/client/#view-an-encrypted-database
|
|
124
|
+
*/
|
|
125
|
+
dbEncryptionKey?: Uint8Array | HexString;
|
|
126
|
+
/**
|
|
127
|
+
* Maximum number of connections in the local DB connection pool.
|
|
128
|
+
*
|
|
129
|
+
* Defaults to 25 when unset. Ignored when `useSingleConnection` is `true`.
|
|
130
|
+
*/
|
|
131
|
+
maxDbPoolSize?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Minimum number of connections kept warm in the local DB connection pool.
|
|
134
|
+
*
|
|
135
|
+
* Defaults to 5 when unset. Ignored when `useSingleConnection` is `true`.
|
|
136
|
+
*/
|
|
137
|
+
minDbPoolSize?: number;
|
|
138
|
+
/**
|
|
139
|
+
* When `true`, the native DB uses a single connection (one file descriptor)
|
|
140
|
+
* instead of a pool. The pool-size options above are ignored. Intended for
|
|
141
|
+
* services running many clients in one process.
|
|
142
|
+
*
|
|
143
|
+
* Defaults to `false` (pooled).
|
|
144
|
+
*/
|
|
145
|
+
useSingleConnection?: boolean;
|
|
191
146
|
};
|
|
192
147
|
type ContentOptions = {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Allow configuring codecs for additional content types
|
|
150
|
+
*/
|
|
151
|
+
codecs?: ContentCodec[];
|
|
197
152
|
};
|
|
198
153
|
type OtherOptions = {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Enable structured JSON logging
|
|
156
|
+
*/
|
|
157
|
+
structuredLogging?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Logging level. Also the level exported to OTLP when `otelEndpoint` is set.
|
|
160
|
+
*/
|
|
161
|
+
loggingLevel?: LogLevel$1;
|
|
162
|
+
/**
|
|
163
|
+
* Level for the stdout console layer only. Defaults to `loggingLevel`. Set to
|
|
164
|
+
* `LogLevel.Warn` to quiet stdout below the OTLP export level — e.g. so a log
|
|
165
|
+
* shipper does not duplicate logs already exported via OTLP, while OTLP still
|
|
166
|
+
* receives `loggingLevel`.
|
|
167
|
+
*/
|
|
168
|
+
stdoutLoggingLevel?: LogLevel$1;
|
|
169
|
+
/**
|
|
170
|
+
* OTLP endpoint (e.g. `"http://collector:4317"`) for exporting telemetry
|
|
171
|
+
* spans and logs. When set, spans (and `tracing` events as correlated logs)
|
|
172
|
+
* are exported via OTLP to this endpoint, where a downstream OpenTelemetry
|
|
173
|
+
* Collector can derive metrics from the spans and forward the logs.
|
|
174
|
+
*
|
|
175
|
+
* Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
|
|
176
|
+
*/
|
|
177
|
+
otelEndpoint?: string;
|
|
178
|
+
/** Service name attached to exported telemetry. */
|
|
179
|
+
otelServiceName?: string;
|
|
180
|
+
/** Fraction of root spans sampled, from 0 to 1. */
|
|
181
|
+
otelSampleRatio?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Resource attributes attached to all exported telemetry spans
|
|
184
|
+
* (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
|
|
185
|
+
* Use these to attribute telemetry to its source.
|
|
186
|
+
*/
|
|
187
|
+
resourceAttributes?: Record<string, string>;
|
|
188
|
+
/**
|
|
189
|
+
* Tuning for the background worker scheduler (intervals, jitter, per-worker
|
|
190
|
+
* overrides, and disabled workers). All fields are optional; omitting this
|
|
191
|
+
* object preserves the default worker behavior.
|
|
192
|
+
*
|
|
193
|
+
* Intervals are specified in nanoseconds.
|
|
194
|
+
*/
|
|
195
|
+
workerConfig?: WorkerConfigOptions$1;
|
|
196
|
+
/**
|
|
197
|
+
* Disable automatic registration when creating a client
|
|
198
|
+
*/
|
|
199
|
+
disableAutoRegister?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* The nonce to use when generating an inbox ID
|
|
202
|
+
* (default: undefined = 1)
|
|
203
|
+
*/
|
|
204
|
+
nonce?: bigint;
|
|
205
|
+
/**
|
|
206
|
+
* Options for waiting until client registration is visible on the network.
|
|
207
|
+
*
|
|
208
|
+
* When set, `registerIdentity` waits until the backend can read the registration.
|
|
209
|
+
*/
|
|
210
|
+
waitForRegistrationVisible?: VisibilityConfirmationOptions$1;
|
|
211
|
+
/**
|
|
212
|
+
* Unstable: notifications for group state changes, for clients that
|
|
213
|
+
* reconcile a group's `appData` themselves.
|
|
214
|
+
*
|
|
215
|
+
* Only `appData` exists today; callbacks for the other mutable fields will
|
|
216
|
+
* be added as further optional properties. Registered at client creation
|
|
217
|
+
* because the changes they report arrive from the stream and sync paths,
|
|
218
|
+
* where no SDK call is on the stack to carry them.
|
|
219
|
+
*
|
|
220
|
+
* The `appData` callback is awaited before message processing continues, so
|
|
221
|
+
* a semantic merge — including republishing via `updateAppData` — can finish
|
|
222
|
+
* first. It fires for changes this client made as well as remote ones, so
|
|
223
|
+
* the merge must be idempotent.
|
|
224
|
+
*/
|
|
225
|
+
unstableChangeCallbacks?: {
|
|
226
|
+
appData?: (change: AppDataChange$1) => Promise<void>;
|
|
227
|
+
};
|
|
270
228
|
};
|
|
271
229
|
type ClientOptions = (NetworkOptions | {
|
|
272
|
-
|
|
230
|
+
backend: Backend$1;
|
|
273
231
|
}) & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions;
|
|
274
232
|
/**
|
|
275
233
|
* `Omit` that distributes over unions. The built-in `Omit` collapses a union
|
|
@@ -279,122 +237,136 @@ type ClientOptions = (NetworkOptions | {
|
|
|
279
237
|
*/
|
|
280
238
|
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
281
239
|
type EnrichedReply<T = unknown, U = unknown> = {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
240
|
+
referenceId: string;
|
|
241
|
+
content: T;
|
|
242
|
+
contentType: ContentTypeId | undefined;
|
|
243
|
+
inReplyTo: DecodedMessage<U> | null;
|
|
286
244
|
};
|
|
287
|
-
type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
|
|
245
|
+
type BuiltInContentTypes = string | LeaveRequest$1 | Reaction$1 | ReadReceipt$1 | Attachment$1 | RemoteAttachment$1 | TransactionReference$1 | WalletSendCalls$1 | Actions$1 | Intent$1 | MultiRemoteAttachment$1 | GroupUpdated$1 | DeletedMessage;
|
|
288
246
|
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
declare const createBackend: (options
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/utils/createBackend.d.ts
|
|
249
|
+
export declare const createBackend: (options: NetworkOptions) => Promise<Backend$1>;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/utils/errors.d.ts
|
|
252
|
+
export declare class InboxReassignError extends Error {
|
|
253
|
+
constructor();
|
|
295
254
|
}
|
|
296
|
-
declare class AccountAlreadyAssociatedError extends Error {
|
|
297
|
-
|
|
255
|
+
export declare class AccountAlreadyAssociatedError extends Error {
|
|
256
|
+
constructor(inboxId: string);
|
|
298
257
|
}
|
|
299
|
-
declare class MissingContentTypeError extends Error {
|
|
300
|
-
|
|
258
|
+
export declare class MissingContentTypeError extends Error {
|
|
259
|
+
constructor();
|
|
301
260
|
}
|
|
302
|
-
declare class SignerUnavailableError extends Error {
|
|
303
|
-
|
|
261
|
+
export declare class SignerUnavailableError extends Error {
|
|
262
|
+
constructor();
|
|
304
263
|
}
|
|
305
|
-
declare class ClientNotInitializedError extends Error {
|
|
306
|
-
|
|
264
|
+
export declare class ClientNotInitializedError extends Error {
|
|
265
|
+
constructor();
|
|
307
266
|
}
|
|
308
|
-
declare class StreamFailedError extends Error {
|
|
309
|
-
|
|
267
|
+
export declare class StreamFailedError extends Error {
|
|
268
|
+
constructor(retryAttempts: number);
|
|
310
269
|
}
|
|
311
|
-
declare class StreamInvalidRetryAttemptsError extends Error {
|
|
312
|
-
|
|
270
|
+
export declare class StreamInvalidRetryAttemptsError extends Error {
|
|
271
|
+
constructor();
|
|
313
272
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
declare const
|
|
317
|
-
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/utils/inboxId.d.ts
|
|
275
|
+
export declare const generateInboxId: (identifier: Identifier$1, nonce?: bigint) => string;
|
|
276
|
+
export declare const getInboxIdForIdentifier: (backend: Backend$1, identifier: Identifier$1) => Promise<string | null>;
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/utils/signer.d.ts
|
|
318
279
|
type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
|
|
319
|
-
type GetIdentifier = () => Promise<Identifier> | Identifier;
|
|
280
|
+
type GetIdentifier = () => Promise<Identifier$1> | Identifier$1;
|
|
320
281
|
type GetChainId = () => bigint;
|
|
321
282
|
type GetBlockNumber = () => bigint;
|
|
322
283
|
type Signer = {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
284
|
+
type: "EOA";
|
|
285
|
+
signMessage: SignMessage;
|
|
286
|
+
getIdentifier: GetIdentifier;
|
|
326
287
|
} | {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
288
|
+
type: "SCW";
|
|
289
|
+
signMessage: SignMessage;
|
|
290
|
+
getIdentifier: GetIdentifier;
|
|
291
|
+
getBlockNumber?: GetBlockNumber;
|
|
292
|
+
getChainId: GetChainId;
|
|
332
293
|
};
|
|
333
294
|
type EOASigner = Extract<Signer, {
|
|
334
|
-
|
|
295
|
+
type: "EOA";
|
|
335
296
|
}>;
|
|
336
297
|
type SCWSigner = Extract<Signer, {
|
|
337
|
-
|
|
298
|
+
type: "SCW";
|
|
338
299
|
}>;
|
|
339
|
-
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/AsyncStream.d.ts
|
|
340
302
|
type ResolveValue<T> = {
|
|
341
|
-
|
|
342
|
-
|
|
303
|
+
value: T;
|
|
304
|
+
done: boolean;
|
|
343
305
|
};
|
|
344
306
|
interface AsyncStreamProxy<T> extends AsyncIterable<T> {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
307
|
+
next(): Promise<ResolveValue<T>>;
|
|
308
|
+
return(): Promise<ResolveValue<undefined>>;
|
|
309
|
+
end(): Promise<ResolveValue<undefined>>;
|
|
310
|
+
isDone: boolean;
|
|
349
311
|
}
|
|
350
|
-
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/utils/streams.d.ts
|
|
351
314
|
declare const DEFAULT_RETRY_DELAY = 60000;
|
|
352
315
|
declare const DEFAULT_RETRY_ATTEMPTS = 10;
|
|
316
|
+
/**
|
|
317
|
+
* Notification streams created by createStream use the retry settings and hooks.
|
|
318
|
+
* Durable message streams use onValue, onError, and onEnd. Core handles their
|
|
319
|
+
* network recovery; notification retry settings and hooks do not apply.
|
|
320
|
+
*/
|
|
353
321
|
type StreamOptions<T = unknown, V = T> = {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Called when the stream ends
|
|
324
|
+
*/
|
|
325
|
+
onEnd?: () => void;
|
|
326
|
+
/**
|
|
327
|
+
* Called when a stream error occurs
|
|
328
|
+
*/
|
|
329
|
+
onError?: (error: Error) => void;
|
|
330
|
+
/**
|
|
331
|
+
* Called when a notification stream fails
|
|
332
|
+
*/
|
|
333
|
+
onFail?: () => void;
|
|
334
|
+
/**
|
|
335
|
+
* Called when a notification stream is restarted
|
|
336
|
+
*/
|
|
337
|
+
onRestart?: () => void;
|
|
338
|
+
/**
|
|
339
|
+
* Called when a notification stream is retried
|
|
340
|
+
*/
|
|
341
|
+
onRetry?: (attempts: number, maxAttempts: number) => void;
|
|
342
|
+
/**
|
|
343
|
+
* Called when a value is emitted from the stream.
|
|
344
|
+
* For message streams, this selects callback mode. Do not also iterate that stream.
|
|
345
|
+
* Message delivery is acknowledged after this callback returns successfully.
|
|
346
|
+
*/
|
|
347
|
+
onValue?: (value: V) => void | Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* The number of times to retry an unexpected notification stream closure.
|
|
350
|
+
* Terminal native storage and network errors are not retried.
|
|
351
|
+
* (default: 10)
|
|
352
|
+
*/
|
|
353
|
+
retryAttempts?: number;
|
|
354
|
+
/**
|
|
355
|
+
* The delay between notification stream retries (in milliseconds)
|
|
356
|
+
* (default: 60000)
|
|
357
|
+
*/
|
|
358
|
+
retryDelay?: number;
|
|
359
|
+
/**
|
|
360
|
+
* Whether to retry a notification stream if it fails
|
|
361
|
+
* (default: true)
|
|
362
|
+
*/
|
|
363
|
+
retryOnFail?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Whether to skip pre-sync for notification streams.
|
|
366
|
+
* Durable message readers start receipt without a separate pre-sync.
|
|
367
|
+
* (default: false)
|
|
368
|
+
*/
|
|
369
|
+
disableSync?: boolean;
|
|
398
370
|
};
|
|
399
371
|
type StreamCallback<T = unknown> = (error: Error | null, value: T | undefined) => void;
|
|
400
372
|
type StreamFunction<T = unknown> = (callback: StreamCallback<T>, onFail: () => void) => Promise<StreamCloser>;
|
|
@@ -402,7 +374,8 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
|
|
|
402
374
|
/**
|
|
403
375
|
* Creates a stream from a stream function
|
|
404
376
|
*
|
|
405
|
-
*
|
|
377
|
+
* Unexpected native closures can be retried. Terminal native storage and
|
|
378
|
+
* network errors end the stream and reject iteration with the original cause.
|
|
406
379
|
*
|
|
407
380
|
* Ending the stream is terminal: no callbacks are invoked and no native
|
|
408
381
|
* stream is created after the stream ends.
|
|
@@ -412,1356 +385,1493 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
|
|
|
412
385
|
* @param streamFunction - The stream function to create a stream from
|
|
413
386
|
* @param streamValueMutator - An optional function to mutate the value emitted from the stream
|
|
414
387
|
* @param options - The options for the stream
|
|
415
|
-
* @param args - Additional arguments to pass to the stream function
|
|
416
388
|
* @returns An async iterable stream proxy
|
|
417
389
|
* @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true
|
|
418
390
|
* @throws {StreamFailedError} if the stream fails and can't be restarted
|
|
419
391
|
*/
|
|
420
392
|
declare const createStream: <T = unknown, V = T>(streamFunction: StreamFunction<T>, streamValueMutator?: StreamValueMutator<T, V | undefined>, options?: StreamOptions<T, V>) => Promise<AsyncStreamProxy<V>>;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
declare const
|
|
424
|
-
declare const
|
|
425
|
-
declare const
|
|
426
|
-
declare const
|
|
427
|
-
declare const
|
|
428
|
-
declare const
|
|
429
|
-
declare const
|
|
430
|
-
declare const
|
|
431
|
-
declare const
|
|
432
|
-
declare const
|
|
433
|
-
declare const
|
|
434
|
-
declare const
|
|
435
|
-
declare const
|
|
436
|
-
declare const
|
|
437
|
-
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/utils/messages.d.ts
|
|
395
|
+
export declare const isReaction: (m: DecodedMessage) => m is DecodedMessage<Reaction$1>;
|
|
396
|
+
export declare const isReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply>;
|
|
397
|
+
export declare const isTextReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply<string>>;
|
|
398
|
+
export declare const isText: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
399
|
+
export declare const isRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<RemoteAttachment$1>;
|
|
400
|
+
export declare const isAttachment: (m: DecodedMessage) => m is DecodedMessage<Attachment$1>;
|
|
401
|
+
export declare const isMultiRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<MultiRemoteAttachment$1>;
|
|
402
|
+
export declare const isTransactionReference: (m: DecodedMessage) => m is DecodedMessage<TransactionReference$1>;
|
|
403
|
+
export declare const isGroupUpdated: (m: DecodedMessage) => m is DecodedMessage<GroupUpdated$1>;
|
|
404
|
+
export declare const isReadReceipt: (m: DecodedMessage) => m is DecodedMessage<ReadReceipt$1>;
|
|
405
|
+
export declare const isLeaveRequest: (m: DecodedMessage) => m is DecodedMessage<LeaveRequest$1>;
|
|
406
|
+
export declare const isWalletSendCalls: (m: DecodedMessage) => m is DecodedMessage<WalletSendCalls$1>;
|
|
407
|
+
export declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent$1>;
|
|
408
|
+
export declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions$1>;
|
|
409
|
+
export declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/MessageStream.d.ts
|
|
412
|
+
type MessageAcknowledgement = {
|
|
413
|
+
checkOwner(): boolean | Promise<boolean>;
|
|
414
|
+
acknowledge(): void | Promise<void>;
|
|
415
|
+
enrichedMessage(): DecodedMessage$1 | null;
|
|
416
|
+
reject(): void | Promise<void>;
|
|
417
|
+
};
|
|
418
|
+
type MessageDelivery<T> = {
|
|
419
|
+
message: T;
|
|
420
|
+
cursor: DeliveryCursor$1;
|
|
421
|
+
acknowledgement: MessageAcknowledgement;
|
|
422
|
+
};
|
|
423
|
+
type MessageReaderSource<T> = {
|
|
424
|
+
nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;
|
|
425
|
+
close(): void | Promise<void>;
|
|
426
|
+
updateScope(groupIds?: string[]): void | Promise<void>;
|
|
427
|
+
updateFilter(conversationType?: ConversationType$1, consentStates?: ConsentState$1[]): void | Promise<void>;
|
|
428
|
+
catchUpSnapshot(): MessageCatchUp$1 | Promise<MessageCatchUp$1>;
|
|
429
|
+
catchUpChanged(): Promise<MessageCatchUp$1>;
|
|
430
|
+
};
|
|
431
|
+
/** One pending item. Construction selects callback mode or next-request acknowledgement. */
|
|
432
|
+
export declare class MessageStream<T, V> implements AsyncIterable<V> {
|
|
433
|
+
#private;
|
|
434
|
+
constructor(reader: MessageReaderSource<T>, convert: (message: T, cursor: DeliveryCursor$1, acknowledgement: MessageAcknowledgement) => V | undefined | Promise<V | undefined>, options?: StreamOptions<T, V>);
|
|
435
|
+
get isDone(): boolean;
|
|
436
|
+
get deliveredCursor(): DeliveryCursor$1 | undefined;
|
|
437
|
+
next: () => Promise<IteratorResult<V, undefined>>;
|
|
438
|
+
return: () => Promise<IteratorReturnResult<undefined>>;
|
|
439
|
+
end: () => Promise<IteratorReturnResult<undefined>>;
|
|
440
|
+
updateScope: (groupIds?: string[]) => void | Promise<void>;
|
|
441
|
+
updateFilter: (conversationType?: ConversationType$1, consentStates?: ConsentState$1[]) => void | Promise<void>;
|
|
442
|
+
catchUpSnapshot: () => MessageCatchUp$1 | Promise<MessageCatchUp$1>;
|
|
443
|
+
catchUpChanged: () => Promise<MessageCatchUp$1>;
|
|
444
|
+
[Symbol.asyncIterator](): this;
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/Notifications.d.ts
|
|
448
|
+
/** Delivery channel for this installation. */
|
|
449
|
+
type NotificationChannel = {
|
|
450
|
+
type: "apns";
|
|
451
|
+
token: string;
|
|
452
|
+
} | {
|
|
453
|
+
type: "fcm";
|
|
454
|
+
token: string;
|
|
455
|
+
} | {
|
|
456
|
+
type: "http";
|
|
457
|
+
url: string;
|
|
458
|
+
signingKey: Uint8Array;
|
|
459
|
+
};
|
|
460
|
+
/** Notification delivery and conversation rules. */
|
|
461
|
+
type NotificationConfig = {
|
|
462
|
+
channel: NotificationChannel;
|
|
463
|
+
/** Defaults to Allowed. An empty list selects no consent states. */
|
|
464
|
+
consentStates?: ConsentState$1[];
|
|
465
|
+
/** Defaults to true. */
|
|
466
|
+
includeWelcomes?: boolean;
|
|
467
|
+
/** Defaults to false. */
|
|
468
|
+
includeSyncGroups?: boolean;
|
|
469
|
+
/** Defaults to false. */
|
|
470
|
+
includeCommits?: boolean;
|
|
471
|
+
};
|
|
472
|
+
/** Reset to the configured consent rules with "default". */
|
|
473
|
+
type NotificationOverride = "enabled" | "disabled" | "default";
|
|
474
|
+
/** A notification failure with a stable error code. */
|
|
475
|
+
export declare class NotificationError extends Error {
|
|
476
|
+
readonly code: string;
|
|
477
|
+
constructor(code: string, options?: ErrorOptions);
|
|
478
|
+
}
|
|
479
|
+
/** Local notification state. Reading it makes no backend request. */
|
|
480
|
+
type NotificationState = {
|
|
481
|
+
state: "disabled";
|
|
482
|
+
} | {
|
|
483
|
+
state: "enabled";
|
|
484
|
+
} | {
|
|
485
|
+
state: "failed";
|
|
486
|
+
error: NotificationError;
|
|
487
|
+
};
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/Conversation.d.ts
|
|
438
490
|
/**
|
|
439
491
|
* Represents a conversation
|
|
440
492
|
*
|
|
441
493
|
* This class is not intended to be initialized directly.
|
|
442
494
|
*/
|
|
443
|
-
declare class Conversation<ContentTypes = unknown> {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
495
|
+
export declare class Conversation<ContentTypes = unknown> {
|
|
496
|
+
#private;
|
|
497
|
+
/**
|
|
498
|
+
* Creates a new conversation instance
|
|
499
|
+
*
|
|
500
|
+
* @param _client - The client instance managing the conversation
|
|
501
|
+
* @param codecRegistry - The codec registry instance
|
|
502
|
+
* @param conversation - The underlying conversation instance
|
|
503
|
+
*/
|
|
504
|
+
constructor(_client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
|
|
505
|
+
/**
|
|
506
|
+
* Gets the unique identifier for this conversation
|
|
507
|
+
*/
|
|
508
|
+
get id(): string;
|
|
509
|
+
/**
|
|
510
|
+
* Gets whether this conversation is currently active
|
|
511
|
+
*/
|
|
512
|
+
get isActive(): boolean;
|
|
513
|
+
/** Override notification rules, or reset the override with "default". */
|
|
514
|
+
setNotifications(value: NotificationOverride): Promise<void>;
|
|
515
|
+
/** Read the effective notification value for this conversation. */
|
|
516
|
+
notificationsEnabled(): Promise<boolean>;
|
|
517
|
+
/**
|
|
518
|
+
* Gets the inbox ID that added this client's inbox to the conversation
|
|
519
|
+
*/
|
|
520
|
+
get addedByInboxId(): string;
|
|
521
|
+
/**
|
|
522
|
+
* Gets the timestamp when the conversation was created in nanoseconds
|
|
523
|
+
*/
|
|
524
|
+
get createdAtNs(): bigint;
|
|
525
|
+
/**
|
|
526
|
+
* Gets the date when the conversation was created
|
|
527
|
+
*/
|
|
528
|
+
get createdAt(): Date;
|
|
529
|
+
get topic(): string;
|
|
530
|
+
pausedForVersion(): string | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* Gets HMAC keys for this conversation
|
|
533
|
+
*
|
|
534
|
+
* @returns The HMAC keys for this conversation
|
|
535
|
+
*/
|
|
536
|
+
hmacKeys(): Record<string, import("@xmtp/node-bindings").HmacKey[]>;
|
|
537
|
+
/**
|
|
538
|
+
* Gets the metadata for this conversation
|
|
539
|
+
*
|
|
540
|
+
* @returns Promise that resolves with the conversation metadata
|
|
541
|
+
*/
|
|
542
|
+
metadata(): Promise<{
|
|
543
|
+
creatorInboxId: string;
|
|
544
|
+
conversationType: import("@xmtp/node-bindings").ConversationType;
|
|
545
|
+
}>;
|
|
546
|
+
/**
|
|
547
|
+
* Gets the members of this conversation
|
|
548
|
+
*
|
|
549
|
+
* @returns Promise that resolves with the conversation members
|
|
550
|
+
*/
|
|
551
|
+
members(): Promise<import("@xmtp/node-bindings").GroupMember[]>;
|
|
552
|
+
/**
|
|
553
|
+
* Synchronizes conversation data from the network
|
|
554
|
+
*
|
|
555
|
+
* @returns Promise that resolves when synchronization is complete
|
|
556
|
+
*/
|
|
557
|
+
sync(): Promise<void>;
|
|
558
|
+
/**
|
|
559
|
+
* Reads retained messages after the default acknowledgement position.
|
|
560
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
561
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
562
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
563
|
+
*
|
|
564
|
+
* @param options - Optional delivery callbacks and replay cursor
|
|
565
|
+
* @returns Stream instance for new messages
|
|
566
|
+
*/
|
|
567
|
+
stream(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
|
|
568
|
+
from?: DeliveryCursor$1;
|
|
569
|
+
}): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
|
|
570
|
+
messageHistorySnapshot(limit: number): import("@xmtp/node-bindings").MessageHistorySnapshot;
|
|
571
|
+
beginningDeliveryCursor(): DeliveryCursor$1;
|
|
572
|
+
/**
|
|
573
|
+
* Decodes, decrypts, and persists a raw envelope from a group message stream.
|
|
574
|
+
*
|
|
575
|
+
* @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream
|
|
576
|
+
* @returns The processed and stored messages
|
|
577
|
+
*/
|
|
578
|
+
processStreamedMessage(envelopeBytes: Uint8Array): Promise<Message$1[]>;
|
|
579
|
+
/**
|
|
580
|
+
* Publishes pending messages that were sent optimistically
|
|
581
|
+
*
|
|
582
|
+
* @returns Promise that resolves when publishing is complete
|
|
583
|
+
*/
|
|
584
|
+
publishMessages(): Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* Sends a message with configurable delivery behavior
|
|
587
|
+
*
|
|
588
|
+
* @param encodedContent - The encoded content to send
|
|
589
|
+
* @param sendOptions - Options for sending the message
|
|
590
|
+
* @param sendOptions.shouldPush - Indicates whether this message should be
|
|
591
|
+
* included in push notifications
|
|
592
|
+
* @param sendOptions.optimistic - Indicates whether this message should be
|
|
593
|
+
* sent optimistically and published later via `publishMessages`
|
|
594
|
+
* @param sendOptions.idempotencyKey - Optional idempotency key; re-sending
|
|
595
|
+
* identical content with the same key produces the same deduplicated message id
|
|
596
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
597
|
+
*/
|
|
598
|
+
send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts$1): Promise<string>;
|
|
599
|
+
/**
|
|
600
|
+
* Sends a text message
|
|
601
|
+
*
|
|
602
|
+
* @param text - The text to send
|
|
603
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
604
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
605
|
+
*/
|
|
606
|
+
sendText(text: string, opts?: SendOpts$1): Promise<string>;
|
|
607
|
+
/**
|
|
608
|
+
* Sends a markdown message
|
|
609
|
+
*
|
|
610
|
+
* @param markdown - The markdown to send
|
|
611
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
612
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
613
|
+
*/
|
|
614
|
+
sendMarkdown(markdown: string, opts?: SendOpts$1): Promise<string>;
|
|
615
|
+
/**
|
|
616
|
+
* Sends a reaction message
|
|
617
|
+
*
|
|
618
|
+
* @param reaction - The reaction to send
|
|
619
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
620
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
621
|
+
*/
|
|
622
|
+
sendReaction(reaction: Reaction$1, opts?: SendOpts$1): Promise<string>;
|
|
623
|
+
/**
|
|
624
|
+
* Sends a read receipt message
|
|
625
|
+
*
|
|
626
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
627
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
628
|
+
*/
|
|
629
|
+
sendReadReceipt(opts?: SendOpts$1): Promise<string>;
|
|
630
|
+
/**
|
|
631
|
+
* Sends a reply message
|
|
632
|
+
*
|
|
633
|
+
* @param reply - The reply to send
|
|
634
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
635
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
636
|
+
*/
|
|
637
|
+
sendReply(reply: Reply$1, opts?: SendOpts$1): Promise<string>;
|
|
638
|
+
/**
|
|
639
|
+
* Sends a transaction reference message
|
|
640
|
+
*
|
|
641
|
+
* @param transactionReference - The transaction reference to send
|
|
642
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
643
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
644
|
+
*/
|
|
645
|
+
sendTransactionReference(transactionReference: TransactionReference$1, opts?: SendOpts$1): Promise<string>;
|
|
646
|
+
/**
|
|
647
|
+
* Sends a wallet send calls message
|
|
648
|
+
*
|
|
649
|
+
* @param walletSendCalls - The wallet send calls to send
|
|
650
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
651
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
652
|
+
*/
|
|
653
|
+
sendWalletSendCalls(walletSendCalls: WalletSendCalls$1, opts?: SendOpts$1): Promise<string>;
|
|
654
|
+
/**
|
|
655
|
+
* Sends a actions message
|
|
656
|
+
*
|
|
657
|
+
* @param actions - The actions to send
|
|
658
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
659
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
660
|
+
*/
|
|
661
|
+
sendActions(actions: Actions$1, opts?: SendOpts$1): Promise<string>;
|
|
662
|
+
/**
|
|
663
|
+
* Sends a intent message
|
|
664
|
+
*
|
|
665
|
+
* @param intent - The intent to send
|
|
666
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
667
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
668
|
+
*/
|
|
669
|
+
sendIntent(intent: Intent$1, opts?: SendOpts$1): Promise<string>;
|
|
670
|
+
/**
|
|
671
|
+
* Sends an attachment message
|
|
672
|
+
*
|
|
673
|
+
* @param attachment - The attachment to send
|
|
674
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
675
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
676
|
+
*/
|
|
677
|
+
sendAttachment(attachment: Attachment$1, opts?: SendOpts$1): Promise<string>;
|
|
678
|
+
/**
|
|
679
|
+
* Sends a multi remote attachment message
|
|
680
|
+
*
|
|
681
|
+
* @param multiRemoteAttachment - The multi remote attachment to send
|
|
682
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
683
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
684
|
+
*/
|
|
685
|
+
sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment$1, opts?: SendOpts$1): Promise<string>;
|
|
686
|
+
/**
|
|
687
|
+
* Sends a remote attachment message
|
|
688
|
+
*
|
|
689
|
+
* @param remoteAttachment - The remote attachment to send
|
|
690
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
691
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
692
|
+
*/
|
|
693
|
+
sendRemoteAttachment(remoteAttachment: RemoteAttachment$1, opts?: SendOpts$1): Promise<string>;
|
|
694
|
+
/**
|
|
695
|
+
* Lists messages in this conversation
|
|
696
|
+
*
|
|
697
|
+
* @param options - Optional filtering and pagination options
|
|
698
|
+
* @returns Promise that resolves with an array of decoded messages
|
|
699
|
+
*/
|
|
700
|
+
messages(options?: ListMessagesOptions$1): Promise<DecodedMessage<ContentTypes>[]>;
|
|
701
|
+
/**
|
|
702
|
+
* Counts messages in this conversation
|
|
703
|
+
*
|
|
704
|
+
* @param options - Optional filtering options
|
|
705
|
+
* @returns Promise that resolves with the count of messages
|
|
706
|
+
*/
|
|
707
|
+
countMessages(options?: Omit<ListMessagesOptions$1, "limit" | "direction">): Promise<number>;
|
|
708
|
+
/**
|
|
709
|
+
* Gets the last message in this conversation
|
|
710
|
+
*
|
|
711
|
+
* @returns Promise that resolves with the last message or undefined if none exists
|
|
712
|
+
*/
|
|
713
|
+
lastMessage(): Promise<DecodedMessage<ContentTypes> | undefined>;
|
|
714
|
+
/**
|
|
715
|
+
* Gets the consent state for this conversation
|
|
716
|
+
*/
|
|
717
|
+
consentState(): ConsentState$1;
|
|
718
|
+
/**
|
|
719
|
+
* Updates the consent state for this conversation
|
|
720
|
+
*
|
|
721
|
+
* @param consentState - The new consent state to set
|
|
722
|
+
*/
|
|
723
|
+
updateConsentState(consentState: ConsentState$1): void;
|
|
724
|
+
/**
|
|
725
|
+
* Gets the message disappearing settings for this conversation
|
|
726
|
+
*
|
|
727
|
+
* @returns The current message disappearing settings or undefined if not set
|
|
728
|
+
*/
|
|
729
|
+
messageDisappearingSettings(): import("@xmtp/node-bindings").MessageDisappearingSettings | undefined;
|
|
730
|
+
/**
|
|
731
|
+
* Updates message disappearing settings for this conversation
|
|
732
|
+
*
|
|
733
|
+
* @param fromNs - The timestamp from which messages should start disappearing
|
|
734
|
+
* @param inNs - The duration after which messages should disappear
|
|
735
|
+
* @returns Promise that resolves when the update is complete
|
|
736
|
+
*/
|
|
737
|
+
updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<void>;
|
|
738
|
+
/**
|
|
739
|
+
* Removes message disappearing settings from this conversation
|
|
740
|
+
*
|
|
741
|
+
* @returns Promise that resolves when the settings are removed
|
|
742
|
+
*/
|
|
743
|
+
removeMessageDisappearingSettings(): Promise<void>;
|
|
744
|
+
/**
|
|
745
|
+
* Checks if message disappearing is enabled for this conversation
|
|
746
|
+
*
|
|
747
|
+
* @returns Whether message disappearing is enabled
|
|
748
|
+
*/
|
|
749
|
+
isMessageDisappearingEnabled(): boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Retrieves information for this conversation to help with debugging
|
|
752
|
+
*
|
|
753
|
+
* @returns The debug information for this conversation
|
|
754
|
+
*/
|
|
755
|
+
debugInfo(): Promise<import("@xmtp/node-bindings").ConversationDebugInfo>;
|
|
756
|
+
/**
|
|
757
|
+
* Retrieves the last read times for this conversation
|
|
758
|
+
*
|
|
759
|
+
* @returns A map keyed by inbox ID with the last read timestamp
|
|
760
|
+
* (nanoseconds since epoch)
|
|
761
|
+
*/
|
|
762
|
+
lastReadTimes(): Promise<Record<string, number>>;
|
|
700
763
|
}
|
|
701
|
-
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/Dm.d.ts
|
|
702
766
|
/**
|
|
703
767
|
* Represents a direct message conversation between two inboxes
|
|
704
768
|
*
|
|
705
769
|
* This class is not intended to be initialized directly.
|
|
706
770
|
*/
|
|
707
|
-
declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
771
|
+
export declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
772
|
+
#private;
|
|
773
|
+
/**
|
|
774
|
+
* Creates a new direct message conversation instance
|
|
775
|
+
*
|
|
776
|
+
* @param client - The client instance managing this direct message conversation
|
|
777
|
+
* @param codecRegistry - The codec registry instance
|
|
778
|
+
* @param conversation - The underlying conversation instance
|
|
779
|
+
*/
|
|
780
|
+
constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
|
|
781
|
+
/**
|
|
782
|
+
* Retrieves the inbox ID of the other participant in the DM
|
|
783
|
+
*
|
|
784
|
+
* @returns Promise that resolves with the peer's inbox ID
|
|
785
|
+
*/
|
|
786
|
+
get peerInboxId(): string;
|
|
787
|
+
duplicateDms(): Promise<Dm<ContentTypes>[]>;
|
|
724
788
|
}
|
|
725
|
-
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/Group.d.ts
|
|
726
791
|
/**
|
|
727
792
|
* Represents a group conversation between multiple inboxes
|
|
728
793
|
*
|
|
729
794
|
* This class is not intended to be initialized directly.
|
|
730
795
|
*/
|
|
731
|
-
declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
796
|
+
export declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
797
|
+
#private;
|
|
798
|
+
/**
|
|
799
|
+
* Creates a new group conversation instance
|
|
800
|
+
*
|
|
801
|
+
* @param client - The client instance managing this group conversation
|
|
802
|
+
* @param codecRegistry - The codec registry instance
|
|
803
|
+
* @param conversation - The underlying conversation object
|
|
804
|
+
*/
|
|
805
|
+
constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
|
|
806
|
+
/**
|
|
807
|
+
* The name of the group
|
|
808
|
+
*/
|
|
809
|
+
get name(): string;
|
|
810
|
+
/**
|
|
811
|
+
* Updates the group's name
|
|
812
|
+
*
|
|
813
|
+
* @param name The new name for the group
|
|
814
|
+
*/
|
|
815
|
+
updateName(name: string): Promise<void>;
|
|
816
|
+
/**
|
|
817
|
+
* The image URL of the group
|
|
818
|
+
*/
|
|
819
|
+
get imageUrl(): string;
|
|
820
|
+
/**
|
|
821
|
+
* Updates the group's image URL
|
|
822
|
+
*
|
|
823
|
+
* @param imageUrl The new image URL for the group
|
|
824
|
+
*/
|
|
825
|
+
updateImageUrl(imageUrl: string): Promise<void>;
|
|
826
|
+
/**
|
|
827
|
+
* The description of the group
|
|
828
|
+
*/
|
|
829
|
+
get description(): string;
|
|
830
|
+
/**
|
|
831
|
+
* Updates the group's description
|
|
832
|
+
*
|
|
833
|
+
* @param description The new description for the group
|
|
834
|
+
*/
|
|
835
|
+
updateDescription(description: string): Promise<void>;
|
|
836
|
+
/**
|
|
837
|
+
* The app data of the group
|
|
838
|
+
*/
|
|
839
|
+
get appData(): string;
|
|
840
|
+
/**
|
|
841
|
+
* Updates the group's app data (max 8192 bytes)
|
|
842
|
+
*
|
|
843
|
+
* @param appData The new app data for the group
|
|
844
|
+
* @param expectedAppData Optional compare-and-swap guard. When provided, the
|
|
845
|
+
* update is abandoned — rather than overwriting — if the committed value is
|
|
846
|
+
* no longer this, including when another member's commit wins the race after
|
|
847
|
+
* this update was published. Callers reconciling structured state should
|
|
848
|
+
* pass the value they merged against, so a concurrent write surfaces as an
|
|
849
|
+
* error instead of silently discarding someone else's change. Omit for
|
|
850
|
+
* last-writer-wins.
|
|
851
|
+
*/
|
|
852
|
+
updateAppData(appData: string, expectedAppData?: string): Promise<void>;
|
|
853
|
+
/**
|
|
854
|
+
* The permissions of the group
|
|
855
|
+
*/
|
|
856
|
+
permissions(): {
|
|
857
|
+
policyType: import("@xmtp/node-bindings").GroupPermissionsOptions;
|
|
858
|
+
policySet: import("@xmtp/node-bindings").PermissionPolicySet;
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Updates a specific permission policy for the group
|
|
862
|
+
*
|
|
863
|
+
* @param permissionType The type of permission to update
|
|
864
|
+
* @param policy The new permission policy
|
|
865
|
+
* @param metadataField Optional metadata field for the permission
|
|
866
|
+
*/
|
|
867
|
+
updatePermission(permissionType: PermissionUpdateType$1, policy: PermissionPolicy$1, metadataField?: MetadataField$1): Promise<void>;
|
|
868
|
+
/**
|
|
869
|
+
* The list of admins of the group
|
|
870
|
+
*/
|
|
871
|
+
listAdmins(): string[];
|
|
872
|
+
/**
|
|
873
|
+
* The list of super admins of the group
|
|
874
|
+
*/
|
|
875
|
+
listSuperAdmins(): string[];
|
|
876
|
+
/**
|
|
877
|
+
* Checks if an inbox is an admin of the group
|
|
878
|
+
*
|
|
879
|
+
* @param inboxId The inbox ID to check
|
|
880
|
+
* @returns Boolean indicating if the inbox is an admin
|
|
881
|
+
*/
|
|
882
|
+
isAdmin(inboxId: string): boolean;
|
|
883
|
+
/**
|
|
884
|
+
* Checks if an inbox is a super admin of the group
|
|
885
|
+
*
|
|
886
|
+
* @param inboxId The inbox ID to check
|
|
887
|
+
* @returns Boolean indicating if the inbox is a super admin
|
|
888
|
+
*/
|
|
889
|
+
isSuperAdmin(inboxId: string): boolean;
|
|
890
|
+
/**
|
|
891
|
+
* Adds members to the group using identifiers
|
|
892
|
+
*
|
|
893
|
+
* @param identifiers Array of member identifiers to add
|
|
894
|
+
*/
|
|
895
|
+
addMembersByIdentifiers(identifiers: Identifier$1[]): Promise<import("@xmtp/node-bindings").UpdateGroupMembershipResult>;
|
|
896
|
+
/**
|
|
897
|
+
* Adds members to the group using inbox IDs
|
|
898
|
+
*
|
|
899
|
+
* @param inboxIds Array of inbox IDs to add
|
|
900
|
+
*/
|
|
901
|
+
addMembers(inboxIds: string[]): Promise<import("@xmtp/node-bindings").UpdateGroupMembershipResult>;
|
|
902
|
+
/**
|
|
903
|
+
* Removes members from the group using identifiers
|
|
904
|
+
*
|
|
905
|
+
* @param identifiers Array of member identifiers to remove
|
|
906
|
+
*/
|
|
907
|
+
removeMembersByIdentifiers(identifiers: Identifier$1[]): Promise<void>;
|
|
908
|
+
/**
|
|
909
|
+
* Removes members from the group using inbox IDs
|
|
910
|
+
*
|
|
911
|
+
* @param inboxIds Array of inbox IDs to remove
|
|
912
|
+
*/
|
|
913
|
+
removeMembers(inboxIds: string[]): Promise<void>;
|
|
914
|
+
/**
|
|
915
|
+
* Promotes a group member to admin status
|
|
916
|
+
*
|
|
917
|
+
* @param inboxId The inbox ID of the member to promote
|
|
918
|
+
*/
|
|
919
|
+
addAdmin(inboxId: string): Promise<void>;
|
|
920
|
+
/**
|
|
921
|
+
* Removes admin status from a group member
|
|
922
|
+
*
|
|
923
|
+
* @param inboxId The inbox ID of the admin to demote
|
|
924
|
+
*/
|
|
925
|
+
removeAdmin(inboxId: string): Promise<void>;
|
|
926
|
+
/**
|
|
927
|
+
* Promotes a group member to super admin status
|
|
928
|
+
*
|
|
929
|
+
* @param inboxId The inbox ID of the member to promote
|
|
930
|
+
*/
|
|
931
|
+
addSuperAdmin(inboxId: string): Promise<void>;
|
|
932
|
+
/**
|
|
933
|
+
* Removes super admin status from a group member
|
|
934
|
+
*
|
|
935
|
+
* @param inboxId The inbox ID of the super admin to demote
|
|
936
|
+
*/
|
|
937
|
+
removeSuperAdmin(inboxId: string): Promise<void>;
|
|
938
|
+
/**
|
|
939
|
+
* Request to leave the group
|
|
940
|
+
*/
|
|
941
|
+
requestRemoval(): Promise<void>;
|
|
942
|
+
/**
|
|
943
|
+
* Checks if the current user has requested to leave the group
|
|
944
|
+
*
|
|
945
|
+
* @returns Boolean
|
|
946
|
+
*/
|
|
947
|
+
isPendingRemoval(): boolean;
|
|
883
948
|
}
|
|
884
|
-
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/Conversations.d.ts
|
|
885
951
|
/**
|
|
886
952
|
* Manages conversations
|
|
887
953
|
*
|
|
888
954
|
* This class is not intended to be initialized directly.
|
|
889
955
|
*/
|
|
890
|
-
declare class Conversations<ContentTypes = unknown> {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
956
|
+
export declare class Conversations<ContentTypes = unknown> {
|
|
957
|
+
#private;
|
|
958
|
+
/**
|
|
959
|
+
* Creates a new conversations instance
|
|
960
|
+
*
|
|
961
|
+
* @param client - The client instance managing the conversations
|
|
962
|
+
* @param codecRegistry - The codec registry instance
|
|
963
|
+
* @param conversations - The underlying conversations instance
|
|
964
|
+
*/
|
|
965
|
+
constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversations: Conversations$1);
|
|
966
|
+
get topic(): string;
|
|
967
|
+
/**
|
|
968
|
+
* Retrieves a conversation by its ID
|
|
969
|
+
*
|
|
970
|
+
* @param id - The conversation ID to look up
|
|
971
|
+
* @returns The conversation if found, undefined otherwise
|
|
972
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
973
|
+
*/
|
|
974
|
+
getConversationById(id: string): Promise<Dm<ContentTypes> | Group<ContentTypes> | undefined>;
|
|
975
|
+
/**
|
|
976
|
+
* Retrieves a DM by inbox ID
|
|
977
|
+
*
|
|
978
|
+
* @param inboxId - The inbox ID to look up
|
|
979
|
+
* @returns The DM if found, undefined otherwise
|
|
980
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
981
|
+
*/
|
|
982
|
+
getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
|
|
983
|
+
/**
|
|
984
|
+
* Retrieves a DM by identifier
|
|
985
|
+
*
|
|
986
|
+
* @param identifier - The identifier to look up
|
|
987
|
+
* @returns Promise that resolves with the DM, if found
|
|
988
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
989
|
+
*/
|
|
990
|
+
fetchDmByIdentifier(identifier: Identifier$1): Promise<Dm<ContentTypes> | undefined>;
|
|
991
|
+
/**
|
|
992
|
+
* Retrieves a message by its ID
|
|
993
|
+
*
|
|
994
|
+
* @param id - The message ID to look up
|
|
995
|
+
* @returns The decoded message if found, undefined otherwise
|
|
996
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
997
|
+
*/
|
|
998
|
+
getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
|
|
999
|
+
/**
|
|
1000
|
+
* Creates a new group conversation without publishing to the network
|
|
1001
|
+
*
|
|
1002
|
+
* @param options - Optional group creation options
|
|
1003
|
+
* @returns The new group
|
|
1004
|
+
* @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group
|
|
1005
|
+
*/
|
|
1006
|
+
createGroupOptimistic(options?: CreateGroupOptions$1): Group<ContentTypes>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Creates a new group conversation with the specified identifiers
|
|
1009
|
+
*
|
|
1010
|
+
* @param identifiers - Array of identifiers for group members
|
|
1011
|
+
* @param options - Optional group creation options
|
|
1012
|
+
* @returns The new group
|
|
1013
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
1014
|
+
*/
|
|
1015
|
+
createGroupWithIdentifiers(identifiers: Identifier$1[], options?: CreateGroupOptions$1): Promise<Group<ContentTypes>>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Creates a new group conversation with the specified inbox IDs
|
|
1018
|
+
*
|
|
1019
|
+
* @param inboxIds - Array of inbox IDs for group members
|
|
1020
|
+
* @param options - Optional group creation options
|
|
1021
|
+
* @returns The new group
|
|
1022
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
1023
|
+
*/
|
|
1024
|
+
createGroup(inboxIds: string[], options?: CreateGroupOptions$1): Promise<Group<ContentTypes>>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Creates a new DM conversation with the specified identifier
|
|
1027
|
+
*
|
|
1028
|
+
* @param identifier - Identifier for the DM recipient
|
|
1029
|
+
* @param options - Optional DM creation options
|
|
1030
|
+
* @returns The new DM
|
|
1031
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
1032
|
+
*/
|
|
1033
|
+
createDmWithIdentifier(identifier: Identifier$1, options?: CreateDmOptions$1): Promise<Dm<ContentTypes>>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Creates a new DM conversation with the specified inbox ID
|
|
1036
|
+
*
|
|
1037
|
+
* @param inboxId - Inbox ID for the DM recipient
|
|
1038
|
+
* @param options - Optional DM creation options
|
|
1039
|
+
* @returns The new DM
|
|
1040
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
1041
|
+
*/
|
|
1042
|
+
createDm(inboxId: string, options?: CreateDmOptions$1): Promise<Dm<ContentTypes>>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Lists all conversations with optional filtering
|
|
1045
|
+
*
|
|
1046
|
+
* @param options - Optional filtering and pagination options
|
|
1047
|
+
* @returns Array of conversations
|
|
1048
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
1049
|
+
*/
|
|
1050
|
+
list(options?: ListConversationsOptions$1): Promise<(Dm<ContentTypes> | Group<ContentTypes>)[]>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Lists all groups with optional filtering
|
|
1053
|
+
*
|
|
1054
|
+
* @param options - Optional filtering and pagination options
|
|
1055
|
+
* @returns Array of groups
|
|
1056
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
1057
|
+
*/
|
|
1058
|
+
listGroups(options?: Omit<ListConversationsOptions$1, "conversationType">): Group<ContentTypes>[];
|
|
1059
|
+
/**
|
|
1060
|
+
* Lists all DMs with optional filtering
|
|
1061
|
+
*
|
|
1062
|
+
* @param options - Optional filtering and pagination options
|
|
1063
|
+
* @returns Array of DMs
|
|
1064
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
1065
|
+
*/
|
|
1066
|
+
listDms(options?: Omit<ListConversationsOptions$1, "conversationType">): Dm<ContentTypes>[];
|
|
1067
|
+
/**
|
|
1068
|
+
* Synchronizes conversations for the current client from the network
|
|
1069
|
+
*
|
|
1070
|
+
* @returns Promise that resolves when sync is complete
|
|
1071
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
1072
|
+
*/
|
|
1073
|
+
sync(): Promise<void>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Synchronizes all conversations and messages from the network with optional
|
|
1076
|
+
* consent state filtering
|
|
1077
|
+
*
|
|
1078
|
+
* @param consentStates - Optional array of consent states to filter by
|
|
1079
|
+
* @returns Promise that resolves when sync is complete
|
|
1080
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
1081
|
+
*/
|
|
1082
|
+
syncAll(consentStates?: ConsentState$1[]): Promise<import("@xmtp/node-bindings").GroupSyncSummary>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Creates a stream for new conversations
|
|
1085
|
+
*
|
|
1086
|
+
* @param options - Optional stream options
|
|
1087
|
+
* @param options.conversationType - Optional conversation type to filter by
|
|
1088
|
+
* @returns Stream instance for new conversations
|
|
1089
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1090
|
+
*/
|
|
1091
|
+
stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
|
|
1092
|
+
conversationType?: ConversationType$1;
|
|
1093
|
+
}): Promise<AsyncStreamProxy<Dm<ContentTypes> | Group<ContentTypes>>>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Creates a stream for new group conversations
|
|
1096
|
+
*
|
|
1097
|
+
* @param options - Optional stream options
|
|
1098
|
+
* @returns Stream instance for new group conversations
|
|
1099
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1100
|
+
*/
|
|
1101
|
+
streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Creates a stream for new DM conversations
|
|
1104
|
+
*
|
|
1105
|
+
* @param options - Optional stream options
|
|
1106
|
+
* @returns Stream instance for new DM conversations
|
|
1107
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1108
|
+
*/
|
|
1109
|
+
streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Reads retained messages after each group's default acknowledgement position.
|
|
1112
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
1113
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
1114
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
1115
|
+
*
|
|
1116
|
+
* @param options - Optional stream options
|
|
1117
|
+
* @param options.conversationType - Optional conversation type to filter by
|
|
1118
|
+
* @param options.consentStates - Optional array of consent states to filter by
|
|
1119
|
+
* @returns Stream instance for new messages
|
|
1120
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1121
|
+
*/
|
|
1122
|
+
streamAllMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
|
|
1123
|
+
conversationType?: ConversationType$1;
|
|
1124
|
+
consentStates?: ConsentState$1[];
|
|
1125
|
+
groupIds?: string[];
|
|
1126
|
+
from?: DeliveryCursor$1;
|
|
1127
|
+
}): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
|
|
1128
|
+
messageHistorySnapshot(limit: number, options?: {
|
|
1129
|
+
groupIds?: string[];
|
|
1130
|
+
conversationType?: ConversationType$1;
|
|
1131
|
+
consentStates?: ConsentState$1[];
|
|
1132
|
+
}): import("@xmtp/node-bindings").MessageHistorySnapshot;
|
|
1133
|
+
beginningDeliveryCursor(): DeliveryCursor$1;
|
|
1134
|
+
/**
|
|
1135
|
+
* Reads retained group messages with default progress or an explicit replay cursor.
|
|
1136
|
+
*
|
|
1137
|
+
* @param options - Optional stream options
|
|
1138
|
+
* @param options.consentStates - Optional array of consent states to filter by
|
|
1139
|
+
* @returns Stream instance for new group messages
|
|
1140
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1141
|
+
*/
|
|
1142
|
+
streamAllGroupMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
|
|
1143
|
+
consentStates?: ConsentState$1[];
|
|
1144
|
+
groupIds?: string[];
|
|
1145
|
+
from?: DeliveryCursor$1;
|
|
1146
|
+
}): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Reads retained DM messages with default progress or an explicit replay cursor.
|
|
1149
|
+
*
|
|
1150
|
+
* @param options - Optional stream options
|
|
1151
|
+
* @param options.consentStates - Optional array of consent states to filter by
|
|
1152
|
+
* @returns Stream instance for new DM messages
|
|
1153
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1154
|
+
*/
|
|
1155
|
+
streamAllDmMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
|
|
1156
|
+
consentStates?: ConsentState$1[];
|
|
1157
|
+
groupIds?: string[];
|
|
1158
|
+
from?: DeliveryCursor$1;
|
|
1159
|
+
}): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Creates a stream for message deletions that streams the message IDs of
|
|
1162
|
+
* deleted messages
|
|
1163
|
+
*
|
|
1164
|
+
* This is a local stream, does not require network sync, and will not fail
|
|
1165
|
+
* like other streams.
|
|
1166
|
+
*
|
|
1167
|
+
* @param options - Optional stream options
|
|
1168
|
+
* @returns Stream instance for message deletions
|
|
1169
|
+
* @deprecated Use streamDeletedMessages instead
|
|
1170
|
+
*/
|
|
1171
|
+
streamMessageDeletions(options?: Omit<StreamOptions<DecodedMessage$1, string>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<string>>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Creates a stream for message deletions that streams the deleted messages
|
|
1174
|
+
*
|
|
1175
|
+
* This is a local stream, does not require network sync, and will not fail
|
|
1176
|
+
* like other streams.
|
|
1177
|
+
*
|
|
1178
|
+
* @param options - Optional stream options
|
|
1179
|
+
* @returns Stream instance for message deletions
|
|
1180
|
+
*/
|
|
1181
|
+
streamDeletedMessages(options?: Omit<StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
|
|
1182
|
+
/**
|
|
1183
|
+
* Gets the HMAC keys for all conversations
|
|
1184
|
+
*
|
|
1185
|
+
* @returns The HMAC keys for all conversations
|
|
1186
|
+
* @see https://docs.xmtp.org/sdk/push-notifications/
|
|
1187
|
+
*/
|
|
1188
|
+
hmacKeys(): Record<string, import("@xmtp/node-bindings").HmacKey[]>;
|
|
1108
1189
|
}
|
|
1109
|
-
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/DebugInformation.d.ts
|
|
1110
1192
|
/**
|
|
1111
1193
|
* Debug information helpers for the client
|
|
1112
1194
|
*
|
|
1113
1195
|
* This class is not intended to be initialized directly.
|
|
1114
1196
|
*/
|
|
1115
|
-
declare class DebugInformation {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1197
|
+
export declare class DebugInformation {
|
|
1198
|
+
#private;
|
|
1199
|
+
constructor(client: Client$1);
|
|
1200
|
+
apiStatistics(): import("@xmtp/node-bindings").ApiStats;
|
|
1201
|
+
apiIdentityStatistics(): import("@xmtp/node-bindings").IdentityStats;
|
|
1202
|
+
apiAggregateStatistics(): string;
|
|
1203
|
+
clearAllStatistics(): void;
|
|
1122
1204
|
}
|
|
1123
|
-
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/Preferences.d.ts
|
|
1124
1207
|
/**
|
|
1125
1208
|
* Manages user preferences and consent states
|
|
1126
1209
|
*
|
|
1127
1210
|
* This class is not intended to be initialized directly.
|
|
1128
1211
|
*/
|
|
1129
|
-
declare class Preferences {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1212
|
+
export declare class Preferences {
|
|
1213
|
+
#private;
|
|
1214
|
+
/**
|
|
1215
|
+
* Creates a new preferences instance
|
|
1216
|
+
*
|
|
1217
|
+
* @param client - The client instance managing preferences
|
|
1218
|
+
* @param conversations - The underlying conversations instance
|
|
1219
|
+
*/
|
|
1220
|
+
constructor(client: Client$1, conversations: Conversations$1);
|
|
1221
|
+
sync(): Promise<import("@xmtp/node-bindings").GroupSyncSummary>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Retrieves the current inbox state of this client from the local database
|
|
1224
|
+
*
|
|
1225
|
+
* @returns Promise that resolves with the inbox state
|
|
1226
|
+
*/
|
|
1227
|
+
inboxState(): Promise<import("@xmtp/node-bindings").InboxState>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Retrieves the latest inbox state of this clientfrom the network
|
|
1230
|
+
*
|
|
1231
|
+
* @returns Promise that resolves with the inbox state
|
|
1232
|
+
*/
|
|
1233
|
+
fetchInboxState(): Promise<import("@xmtp/node-bindings").InboxState>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Retrieves the current inbox states for specified inbox IDs from the local
|
|
1236
|
+
* database
|
|
1237
|
+
*
|
|
1238
|
+
* @param inboxIds - Array of inbox IDs to get state for
|
|
1239
|
+
* @returns Promise that resolves with the inbox states for the inbox IDs
|
|
1240
|
+
*/
|
|
1241
|
+
getInboxStates(inboxIds: string[]): Promise<import("@xmtp/node-bindings").InboxState[]>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Retrieves the latest inbox states for specified inbox IDs from the network
|
|
1244
|
+
*
|
|
1245
|
+
* @param inboxIds - Array of inbox IDs to get state for
|
|
1246
|
+
* @returns Promise that resolves with the inbox states for the inbox IDs
|
|
1247
|
+
*/
|
|
1248
|
+
fetchInboxStates(inboxIds: string[]): Promise<import("@xmtp/node-bindings").InboxState[]>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Updates consent states for multiple records
|
|
1251
|
+
*
|
|
1252
|
+
* @param consentStates - Array of consent records to update
|
|
1253
|
+
* @returns Promise that resolves when consent states are updated
|
|
1254
|
+
*/
|
|
1255
|
+
setConsentStates(consentStates: Consent$1[]): Promise<void>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Retrieves consent state for a specific entity
|
|
1258
|
+
*
|
|
1259
|
+
* @param entityType - Type of entity to get consent for
|
|
1260
|
+
* @param entity - Entity identifier
|
|
1261
|
+
* @returns Promise that resolves with the consent state
|
|
1262
|
+
*/
|
|
1263
|
+
getConsentState(entityType: ConsentEntityType$1, entity: string): Promise<import("@xmtp/node-bindings").ConsentState>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Creates a stream of consent state updates
|
|
1266
|
+
*
|
|
1267
|
+
* @param options - Optional stream options
|
|
1268
|
+
* @returns Stream instance for consent updates
|
|
1269
|
+
*/
|
|
1270
|
+
streamConsent(options?: StreamOptions<Consent$1[]>): Promise<AsyncStreamProxy<Consent$1[]>>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Creates a stream of user preference updates
|
|
1273
|
+
*
|
|
1274
|
+
* @param options - Optional stream options
|
|
1275
|
+
* @returns Stream instance for preference updates
|
|
1276
|
+
*/
|
|
1277
|
+
streamPreferences(options?: StreamOptions<UserPreferenceUpdate$1[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate$1[]>>;
|
|
1195
1278
|
}
|
|
1196
|
-
|
|
1279
|
+
//#endregion
|
|
1280
|
+
//#region src/Client.d.ts
|
|
1197
1281
|
/**
|
|
1198
1282
|
* Client for interacting with the XMTP network
|
|
1199
1283
|
*/
|
|
1200
|
-
declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
static isAddressAuthorized(inboxId: string, address: string, backend?: Backend): Promise<boolean>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Checks if an address is authorized for an inbox
|
|
1666
|
-
*
|
|
1667
|
-
* @param inboxId - The inbox ID to check
|
|
1668
|
-
* @param address - The address to check
|
|
1669
|
-
* @param env - The environment to use
|
|
1670
|
-
* @param gatewayHost - Optional gateway host
|
|
1671
|
-
* @returns Whether the address is authorized
|
|
1672
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1673
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1674
|
-
*/
|
|
1675
|
-
static isAddressAuthorized(inboxId: string, address: string, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1676
|
-
/**
|
|
1677
|
-
* Checks if an installation is authorized for an inbox
|
|
1678
|
-
*
|
|
1679
|
-
* @param inboxId - The inbox ID to check
|
|
1680
|
-
* @param installation - The installation to check
|
|
1681
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1682
|
-
* @returns Whether the installation is authorized
|
|
1683
|
-
*/
|
|
1684
|
-
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, backend?: Backend): Promise<boolean>;
|
|
1685
|
-
/**
|
|
1686
|
-
* Checks if an installation is authorized for an inbox
|
|
1687
|
-
*
|
|
1688
|
-
* @param inboxId - The inbox ID to check
|
|
1689
|
-
* @param installation - The installation to check
|
|
1690
|
-
* @param env - The environment to use
|
|
1691
|
-
* @param gatewayHost - Optional gateway host
|
|
1692
|
-
* @returns Whether the installation is authorized
|
|
1693
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1694
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1695
|
-
*/
|
|
1696
|
-
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1697
|
-
/**
|
|
1698
|
-
* Send a sync request to other devices on the network
|
|
1699
|
-
*
|
|
1700
|
-
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
1701
|
-
* @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
|
|
1702
|
-
* @returns Promise that resolves when the sync request is sent
|
|
1703
|
-
*/
|
|
1704
|
-
sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
1705
|
-
/**
|
|
1706
|
-
* Send a sync archive to the sync group
|
|
1707
|
-
*
|
|
1708
|
-
* @param pin - The pin used for reference when importing
|
|
1709
|
-
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
1710
|
-
* @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
|
|
1711
|
-
* @returns Promise that resolves when the sync archive is sent
|
|
1712
|
-
*/
|
|
1713
|
-
sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
1714
|
-
/**
|
|
1715
|
-
* Process a sync archive that matches the pin given
|
|
1716
|
-
*
|
|
1717
|
-
* @param archivePin - Optional pin to match. If not provided, processes the last archive sent
|
|
1718
|
-
* @returns Promise that resolves when the archive is processed
|
|
1719
|
-
*/
|
|
1720
|
-
processSyncArchive(archivePin?: string | null): Promise<void>;
|
|
1721
|
-
/**
|
|
1722
|
-
* List the archives available for import in the sync group
|
|
1723
|
-
*
|
|
1724
|
-
* You may need to manually sync the sync group before calling
|
|
1725
|
-
* this function to see recently uploaded archives.
|
|
1726
|
-
*
|
|
1727
|
-
* @param daysCutoff - Number of days to look back for archives
|
|
1728
|
-
* @returns Array of available archive information
|
|
1729
|
-
*/
|
|
1730
|
-
listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[];
|
|
1731
|
-
/**
|
|
1732
|
-
* Archive application elements to file for later restoration
|
|
1733
|
-
*
|
|
1734
|
-
* @param path - The file path to save the archive
|
|
1735
|
-
* @param key - Encryption key for the archive
|
|
1736
|
-
* @param opts - Archive options specifying what to include (defaults to consent and messages)
|
|
1737
|
-
* @returns Promise that resolves when the archive is created
|
|
1738
|
-
*/
|
|
1739
|
-
createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions): Promise<void>;
|
|
1740
|
-
/**
|
|
1741
|
-
* Import a previous archive from a file
|
|
1742
|
-
*
|
|
1743
|
-
* @param path - The file path to the archive
|
|
1744
|
-
* @param key - Encryption key for the archive
|
|
1745
|
-
* @returns Promise that resolves when the archive is imported
|
|
1746
|
-
*/
|
|
1747
|
-
importArchive(path: string, key: Uint8Array): Promise<void>;
|
|
1748
|
-
/**
|
|
1749
|
-
* Load the metadata for an archive to see what it contains
|
|
1750
|
-
*
|
|
1751
|
-
* Reads only the metadata without loading the entire file, so this function is quick.
|
|
1752
|
-
*
|
|
1753
|
-
* @param path - The file path to the archive
|
|
1754
|
-
* @param key - Encryption key for the archive
|
|
1755
|
-
* @returns Promise that resolves with the archive metadata
|
|
1756
|
-
*/
|
|
1757
|
-
archiveMetadata(path: string, key: Uint8Array): Promise<ArchiveMetadata>;
|
|
1758
|
-
/**
|
|
1759
|
-
* Manually sync all device sync groups
|
|
1760
|
-
*
|
|
1761
|
-
* @returns Promise that resolves with a summary of the sync operation
|
|
1762
|
-
*/
|
|
1763
|
-
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
|
|
1284
|
+
export declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
1285
|
+
#private;
|
|
1286
|
+
/**
|
|
1287
|
+
* Creates a new XMTP client instance
|
|
1288
|
+
*
|
|
1289
|
+
* This class is not intended to be initialized directly.
|
|
1290
|
+
* Use `Client.create` or `Client.build` instead.
|
|
1291
|
+
*
|
|
1292
|
+
* @param options - Optional configuration for the client
|
|
1293
|
+
*/
|
|
1294
|
+
constructor(options?: ClientOptions);
|
|
1295
|
+
/**
|
|
1296
|
+
* Initializes the client with the provided identifier
|
|
1297
|
+
*
|
|
1298
|
+
* This is not meant to be called directly.
|
|
1299
|
+
* Use `Client.create` or `Client.build` instead.
|
|
1300
|
+
*
|
|
1301
|
+
* @param identifier - The identifier to initialize the client with
|
|
1302
|
+
*/
|
|
1303
|
+
init(identifier: Identifier$1): Promise<void>;
|
|
1304
|
+
/**
|
|
1305
|
+
* Creates a new client instance with a signer
|
|
1306
|
+
*
|
|
1307
|
+
* @param signer - The signer to use for authentication
|
|
1308
|
+
* @param options - Optional configuration for the client
|
|
1309
|
+
* @returns A new client instance
|
|
1310
|
+
*/
|
|
1311
|
+
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1312
|
+
codecs?: ContentCodecs;
|
|
1313
|
+
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Creates a new client instance with an identifier
|
|
1316
|
+
*
|
|
1317
|
+
* Clients created with this method must already be registered.
|
|
1318
|
+
* Any methods called that require a signer will throw an error.
|
|
1319
|
+
*
|
|
1320
|
+
* @param identifier - The identifier to use
|
|
1321
|
+
* @param options - Optional configuration for the client
|
|
1322
|
+
* @returns A new client instance
|
|
1323
|
+
*/
|
|
1324
|
+
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier$1, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1325
|
+
codecs?: ContentCodecs;
|
|
1326
|
+
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Gets the version of libxmtp used in the bindings
|
|
1329
|
+
*/
|
|
1330
|
+
get libxmtpVersion(): string | undefined;
|
|
1331
|
+
/**
|
|
1332
|
+
* Gets the app version used by the client
|
|
1333
|
+
*/
|
|
1334
|
+
get appVersion(): string | undefined;
|
|
1335
|
+
/**
|
|
1336
|
+
* Gets the label used for the default database file name
|
|
1337
|
+
*
|
|
1338
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1339
|
+
*/
|
|
1340
|
+
get env(): string;
|
|
1341
|
+
/**
|
|
1342
|
+
* Gets the client options
|
|
1343
|
+
*/
|
|
1344
|
+
get options(): ClientOptions | undefined;
|
|
1345
|
+
/**
|
|
1346
|
+
* Gets the signer associated with this client
|
|
1347
|
+
*/
|
|
1348
|
+
get signer(): Signer | undefined;
|
|
1349
|
+
/**
|
|
1350
|
+
* Gets the account identifier for this client
|
|
1351
|
+
*/
|
|
1352
|
+
get accountIdentifier(): Identifier$1 | undefined;
|
|
1353
|
+
/**
|
|
1354
|
+
* Gets the inbox ID associated with this client
|
|
1355
|
+
*/
|
|
1356
|
+
get inboxId(): string;
|
|
1357
|
+
/**
|
|
1358
|
+
* Gets the installation ID for this client
|
|
1359
|
+
*/
|
|
1360
|
+
get installationId(): string;
|
|
1361
|
+
/**
|
|
1362
|
+
* Gets the installation ID bytes for this client
|
|
1363
|
+
*/
|
|
1364
|
+
get installationIdBytes(): Uint8Array<ArrayBufferLike>;
|
|
1365
|
+
/**
|
|
1366
|
+
* Gets whether the client is registered with the XMTP network
|
|
1367
|
+
*
|
|
1368
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1369
|
+
*/
|
|
1370
|
+
get isRegistered(): boolean;
|
|
1371
|
+
/**
|
|
1372
|
+
* Gets the conversations manager for this client
|
|
1373
|
+
*
|
|
1374
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1375
|
+
*/
|
|
1376
|
+
get conversations(): Conversations<ContentTypes>;
|
|
1377
|
+
/**
|
|
1378
|
+
* Gets the debug information helpersfor this client
|
|
1379
|
+
*
|
|
1380
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1381
|
+
*/
|
|
1382
|
+
get debugInformation(): DebugInformation;
|
|
1383
|
+
/**
|
|
1384
|
+
* Gets the preferences manager for this client
|
|
1385
|
+
*
|
|
1386
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1387
|
+
*/
|
|
1388
|
+
get preferences(): Preferences;
|
|
1389
|
+
/**
|
|
1390
|
+
* Cleanly shuts down the client: cancels in-flight workers and detached
|
|
1391
|
+
* streams, then releases the database connection.
|
|
1392
|
+
*
|
|
1393
|
+
* This is idempotent — calling it more than once resolves without error.
|
|
1394
|
+
* Await this before deleting the database file or dropping the client
|
|
1395
|
+
* reference to avoid log noise from background tasks running against a
|
|
1396
|
+
* closed database.
|
|
1397
|
+
*
|
|
1398
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1399
|
+
* @returns Promise that resolves when the client has shut down
|
|
1400
|
+
*/
|
|
1401
|
+
close(): Promise<void>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Adds a signature to a signature request using the client's signer (or the
|
|
1404
|
+
* provided signer)
|
|
1405
|
+
*
|
|
1406
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1407
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1408
|
+
* requirements of an application.
|
|
1409
|
+
*
|
|
1410
|
+
* It is highly recommended to use the `register`, `unsafe_addAccount`,
|
|
1411
|
+
* `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
|
|
1412
|
+
* methods instead.
|
|
1413
|
+
*
|
|
1414
|
+
* @param signatureRequest - The signature request to add the signature to
|
|
1415
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1416
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1417
|
+
*/
|
|
1418
|
+
unsafe_addSignature(signatureRequest: SignatureRequestHandle$1, signer?: Signer): Promise<void>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns a signature request handler for creating a new inbox
|
|
1421
|
+
*
|
|
1422
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1423
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1424
|
+
* requirements of an application.
|
|
1425
|
+
*
|
|
1426
|
+
* It is highly recommended to use the `register` method instead.
|
|
1427
|
+
*
|
|
1428
|
+
* @returns The signature text
|
|
1429
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1430
|
+
*/
|
|
1431
|
+
unsafe_createInboxSignatureRequest(): Promise<SignatureRequestHandle$1 | null>;
|
|
1432
|
+
/**
|
|
1433
|
+
* Returns a signature request handler for adding a new account to the
|
|
1434
|
+
* client's inbox
|
|
1435
|
+
*
|
|
1436
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1437
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1438
|
+
* requirements of an application.
|
|
1439
|
+
*
|
|
1440
|
+
* It is highly recommended to use the `unsafe_addAccount` method instead.
|
|
1441
|
+
*
|
|
1442
|
+
* The `allowInboxReassign` parameter must be true or this function will
|
|
1443
|
+
* throw an error.
|
|
1444
|
+
*
|
|
1445
|
+
* @param newAccountIdentifier - The identifier of the new account
|
|
1446
|
+
* @param allowInboxReassign - Whether to allow inbox reassignment
|
|
1447
|
+
* @returns The signature text
|
|
1448
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1449
|
+
*/
|
|
1450
|
+
unsafe_addAccountSignatureRequest(newAccountIdentifier: Identifier$1, allowInboxReassign?: boolean): Promise<SignatureRequestHandle$1>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Returns a signature request handler for removing an account from the
|
|
1453
|
+
* client's inbox
|
|
1454
|
+
*
|
|
1455
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1456
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1457
|
+
* requirements of an application.
|
|
1458
|
+
*
|
|
1459
|
+
* It is highly recommended to use the `removeAccount` method instead.
|
|
1460
|
+
*
|
|
1461
|
+
* @param identifier - The identifier of the account to remove
|
|
1462
|
+
* @returns The signature text
|
|
1463
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1464
|
+
*/
|
|
1465
|
+
unsafe_removeAccountSignatureRequest(identifier: Identifier$1): Promise<SignatureRequestHandle$1>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Returns a signature request handler for revoking all other installations
|
|
1468
|
+
* of the client's inbox
|
|
1469
|
+
*
|
|
1470
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1471
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1472
|
+
* requirements of an application.
|
|
1473
|
+
*
|
|
1474
|
+
* It is highly recommended to use the `revokeAllOtherInstallations` method instead.
|
|
1475
|
+
*
|
|
1476
|
+
* @returns The signature text
|
|
1477
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1478
|
+
*/
|
|
1479
|
+
unsafe_revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle$1 | null>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns a signature request handler for revoking specific installations
|
|
1482
|
+
* of the client's inbox
|
|
1483
|
+
*
|
|
1484
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1485
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1486
|
+
* requirements of an application.
|
|
1487
|
+
*
|
|
1488
|
+
* It is highly recommended to use the `revokeInstallations` method instead.
|
|
1489
|
+
*
|
|
1490
|
+
* @param installationIds - The installation IDs to revoke
|
|
1491
|
+
* @returns The signature text
|
|
1492
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1493
|
+
*/
|
|
1494
|
+
unsafe_revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle$1>;
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns a signature request handler for changing the recovery identifier
|
|
1497
|
+
* for this client's inbox
|
|
1498
|
+
*
|
|
1499
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1500
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1501
|
+
* requirements of an application.
|
|
1502
|
+
*
|
|
1503
|
+
* It is highly recommended to use the `changeRecoveryIdentifier` method instead.
|
|
1504
|
+
*
|
|
1505
|
+
* @param identifier - The new recovery identifier
|
|
1506
|
+
* @returns The signature text
|
|
1507
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1508
|
+
*/
|
|
1509
|
+
unsafe_changeRecoveryIdentifierSignatureRequest(identifier: Identifier$1): Promise<SignatureRequestHandle$1>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Applies a signature request to the client
|
|
1512
|
+
*
|
|
1513
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
1514
|
+
* for use in special cases where the provided workflows do not meet the
|
|
1515
|
+
* requirements of an application.
|
|
1516
|
+
*
|
|
1517
|
+
* It is highly recommended to use the `register`, `unsafe_addAccount`,
|
|
1518
|
+
* `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
|
|
1519
|
+
* methods instead.
|
|
1520
|
+
*
|
|
1521
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1522
|
+
*/
|
|
1523
|
+
unsafe_applySignatureRequest(signatureRequest: SignatureRequestHandle$1): Promise<void>;
|
|
1524
|
+
/**
|
|
1525
|
+
* Registers the client with the XMTP network
|
|
1526
|
+
*
|
|
1527
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1528
|
+
*
|
|
1529
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1530
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1531
|
+
*/
|
|
1532
|
+
register(): Promise<void>;
|
|
1533
|
+
/**
|
|
1534
|
+
* Adds a new account to the client inbox
|
|
1535
|
+
*
|
|
1536
|
+
* WARNING: This function should be used with caution. Adding a wallet already
|
|
1537
|
+
* associated with an inbox ID will cause the wallet to lose access to
|
|
1538
|
+
* that inbox.
|
|
1539
|
+
*
|
|
1540
|
+
* The `allowInboxReassign` parameter must be true to reassign an inbox
|
|
1541
|
+
* already associated with a different account.
|
|
1542
|
+
*
|
|
1543
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1544
|
+
*
|
|
1545
|
+
* @param newAccountSigner - The signer for the new account
|
|
1546
|
+
* @param allowInboxReassign - Whether to allow inbox reassignment
|
|
1547
|
+
* @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID
|
|
1548
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1549
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1550
|
+
*/
|
|
1551
|
+
unsafe_addAccount(newAccountSigner: Signer, allowInboxReassign?: boolean): Promise<void>;
|
|
1552
|
+
/**
|
|
1553
|
+
* Removes an account from the client's inbox
|
|
1554
|
+
*
|
|
1555
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1556
|
+
*
|
|
1557
|
+
* @param identifier - The identifier of the account to remove
|
|
1558
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1559
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1560
|
+
*/
|
|
1561
|
+
removeAccount(identifier: Identifier$1): Promise<void>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Revokes all other installations of the client's inbox
|
|
1564
|
+
*
|
|
1565
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1566
|
+
*
|
|
1567
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1568
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1569
|
+
*/
|
|
1570
|
+
revokeAllOtherInstallations(): Promise<void>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Revokes specific installations of the client's inbox
|
|
1573
|
+
*
|
|
1574
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1575
|
+
*
|
|
1576
|
+
* @param installationIds - The installation IDs to revoke
|
|
1577
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1578
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1579
|
+
*/
|
|
1580
|
+
revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
|
|
1581
|
+
/** Revoke installations with an explicit backend or network options. */
|
|
1582
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], optionsOrBackend: NetworkOptions | Backend$1): Promise<void>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Changes the recovery identifier for the client's inbox
|
|
1585
|
+
*
|
|
1586
|
+
* Requires a signer, use `Client.create` to create a client with a signer.
|
|
1587
|
+
*
|
|
1588
|
+
* @param identifier - The new recovery identifier
|
|
1589
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1590
|
+
* @throws {SignerUnavailableError} if no signer is available
|
|
1591
|
+
*/
|
|
1592
|
+
changeRecoveryIdentifier(identifier: Identifier$1): Promise<void>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Checks if the client can message the specified identifiers
|
|
1595
|
+
*
|
|
1596
|
+
* @param identifiers - The identifiers to check
|
|
1597
|
+
* @returns Whether the client can message the identifiers
|
|
1598
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1599
|
+
*/
|
|
1600
|
+
canMessage(identifiers: Identifier$1[]): Promise<Map<string, boolean>>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
1603
|
+
*
|
|
1604
|
+
* @param inboxIds - The inbox IDs to check
|
|
1605
|
+
* @returns Map of inbox IDs to their updates count
|
|
1606
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1607
|
+
*/
|
|
1608
|
+
fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Fetches the latest inbox updates count for the client's inbox
|
|
1611
|
+
*
|
|
1612
|
+
* @returns The latest inbox updates count
|
|
1613
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1614
|
+
*/
|
|
1615
|
+
fetchOwnInboxUpdatesCount(): Promise<number>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Fetches the key package statuses from the network for the specified
|
|
1618
|
+
* installation IDs
|
|
1619
|
+
*
|
|
1620
|
+
* @param installationIds - The installation IDs to check
|
|
1621
|
+
* @returns The key package statuses
|
|
1622
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1623
|
+
*/
|
|
1624
|
+
fetchKeyPackageStatuses(installationIds: string[]): Promise<Record<string, import("@xmtp/node-bindings").KeyPackageStatus>>;
|
|
1625
|
+
/**
|
|
1626
|
+
* Fetches the inbox ID for a given identifier from the local database
|
|
1627
|
+
* If not found, fetches from the network
|
|
1628
|
+
*
|
|
1629
|
+
* @param identifier - The identifier to look up
|
|
1630
|
+
* @returns The inbox ID, if found
|
|
1631
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1632
|
+
*/
|
|
1633
|
+
fetchInboxIdByIdentifier(identifier: Identifier$1): Promise<string | null>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Signs a message with the installation key
|
|
1636
|
+
*
|
|
1637
|
+
* @param signatureText - The text to sign
|
|
1638
|
+
* @returns The signature
|
|
1639
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1640
|
+
*/
|
|
1641
|
+
signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Verifies a signature was made with the installation key
|
|
1644
|
+
*
|
|
1645
|
+
* @param signatureText - The text that was signed
|
|
1646
|
+
* @param signatureBytes - The signature bytes to verify
|
|
1647
|
+
* @returns Whether the signature is valid
|
|
1648
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1649
|
+
*/
|
|
1650
|
+
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
1651
|
+
/** Fetch inbox states with an explicit backend or network options. */
|
|
1652
|
+
static fetchInboxStates(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend$1): Promise<import("@xmtp/node-bindings").InboxState[]>;
|
|
1653
|
+
/** Fetch inbox update counts with an explicit backend or network options. */
|
|
1654
|
+
static fetchLatestInboxUpdatesCount(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend$1): Promise<Map<string, number>>;
|
|
1655
|
+
/** Check identifiers with an explicit backend or network options. */
|
|
1656
|
+
static canMessage(identifiers: Identifier$1[], optionsOrBackend: NetworkOptions | Backend$1): Promise<Map<string, boolean>>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Verifies a signature was made with a public key
|
|
1659
|
+
*
|
|
1660
|
+
* @param signatureText - The text that was signed
|
|
1661
|
+
* @param signatureBytes - The signature bytes to verify
|
|
1662
|
+
* @param publicKey - The public key to verify against
|
|
1663
|
+
* @returns Whether the signature is valid
|
|
1664
|
+
*/
|
|
1665
|
+
static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
1666
|
+
/** Check address authorization with an explicit backend or network options. */
|
|
1667
|
+
static isAddressAuthorized(inboxId: string, address: string, optionsOrBackend: NetworkOptions | Backend$1): Promise<boolean>;
|
|
1668
|
+
/** Check installation authorization with an explicit backend or network options. */
|
|
1669
|
+
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, optionsOrBackend: NetworkOptions | Backend$1): Promise<boolean>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Archive application elements to file for later restoration
|
|
1672
|
+
*
|
|
1673
|
+
* @param path - The file path to save the archive
|
|
1674
|
+
* @param key - Encryption key for the archive
|
|
1675
|
+
* @param opts - Archive options specifying what to include (defaults to consent and messages)
|
|
1676
|
+
* @returns Promise that resolves when the archive is created
|
|
1677
|
+
*/
|
|
1678
|
+
createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions$1): Promise<void>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Import a previous archive from a file
|
|
1681
|
+
*
|
|
1682
|
+
* @param path - The file path to the archive
|
|
1683
|
+
* @param key - Encryption key for the archive
|
|
1684
|
+
* @returns Promise that resolves when the archive is imported
|
|
1685
|
+
*/
|
|
1686
|
+
importArchive(path: string, key: Uint8Array): Promise<void>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Load the metadata for an archive to see what it contains
|
|
1689
|
+
*
|
|
1690
|
+
* Reads only the metadata without loading the entire file, so this function is quick.
|
|
1691
|
+
*
|
|
1692
|
+
* @param path - The file path to the archive
|
|
1693
|
+
* @param key - Encryption key for the archive
|
|
1694
|
+
* @returns Promise that resolves with the archive metadata
|
|
1695
|
+
*/
|
|
1696
|
+
archiveMetadata(path: string, key: Uint8Array): Promise<ArchiveMetadata$1>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Manually sync all device sync groups
|
|
1699
|
+
*
|
|
1700
|
+
* @returns Promise that resolves with a summary of the sync operation
|
|
1701
|
+
*/
|
|
1702
|
+
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary$1>;
|
|
1703
|
+
/** Enable notifications and register the delivery channel. */
|
|
1704
|
+
enableNotifications(config: NotificationConfig): Promise<NotificationState>;
|
|
1705
|
+
/** Disable notifications. Per-conversation overrides remain stored. */
|
|
1706
|
+
disableNotifications(): Promise<void>;
|
|
1707
|
+
/** Read the local state without a backend request. */
|
|
1708
|
+
notificationState(): Promise<NotificationState>;
|
|
1709
|
+
/**
|
|
1710
|
+
* What the deployment published about itself, as this client resolved it
|
|
1711
|
+
* when it was built.
|
|
1712
|
+
*
|
|
1713
|
+
* Reads memory and makes no backend request. The value never changes for the
|
|
1714
|
+
* life of the client: a background refresh rewrites the stored copy, and a
|
|
1715
|
+
* new value takes effect at the next build.
|
|
1716
|
+
*
|
|
1717
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1718
|
+
*/
|
|
1719
|
+
serverConfiguration(): ServerConfiguration$1;
|
|
1720
|
+
/**
|
|
1721
|
+
* Fetch the deployment configuration now, rewrite the stored copy, and
|
|
1722
|
+
* return what was fetched.
|
|
1723
|
+
*
|
|
1724
|
+
* The snapshot this client holds is unchanged; use it to observe a change an
|
|
1725
|
+
* operator has made without restarting.
|
|
1726
|
+
*
|
|
1727
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1728
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1729
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1730
|
+
* @throws {BackendMismatchError} if it published a different identifier
|
|
1731
|
+
* @throws {ClientVersionTooOldError} if it now requires a newer libxmtp
|
|
1732
|
+
*/
|
|
1733
|
+
refreshServerConfiguration(): Promise<ServerConfiguration$1>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Read what a deployment publishes about itself with no database, no client,
|
|
1736
|
+
* and no credential.
|
|
1737
|
+
*
|
|
1738
|
+
* Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted
|
|
1739
|
+
* smart contract wallet chains before it decides how to build a client.
|
|
1740
|
+
* Nothing is stored and no identifier binding is applied.
|
|
1741
|
+
*
|
|
1742
|
+
* @param target - A backend URL, network options, or an existing backend
|
|
1743
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1744
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1745
|
+
*/
|
|
1746
|
+
static fetchServerConfiguration(target: string | NetworkOptions | Backend$1): Promise<ServerConfiguration$1>;
|
|
1764
1747
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
export type
|
|
1748
|
+
//#endregion
|
|
1749
|
+
//#region src/utils/streamFailure.d.ts
|
|
1750
|
+
export type StreamFailureCause = {
|
|
1751
|
+
kind: "target_pending" | "receipt_pending" | "processing_pending" | "blocked" | "storage" | "receiver" | "invalid_topic";
|
|
1752
|
+
code: string | null;
|
|
1753
|
+
message: string;
|
|
1754
|
+
retryable: boolean;
|
|
1755
|
+
};
|
|
1756
|
+
export type UnfinishedStreamTopic = {
|
|
1757
|
+
topic: Uint8Array;
|
|
1758
|
+
/** Null means that target capture did not complete. */
|
|
1759
|
+
target: bigint | null;
|
|
1760
|
+
received: bigint;
|
|
1761
|
+
processed: bigint;
|
|
1762
|
+
unresolvedWelcomes: bigint[];
|
|
1763
|
+
inactive: boolean;
|
|
1764
|
+
cause: StreamFailureCause | null;
|
|
1765
|
+
};
|
|
1766
|
+
export type StreamBarrierFailure = {
|
|
1767
|
+
reason: "blocked" | "deadline" | "cancelled";
|
|
1768
|
+
unfinished: UnfinishedStreamTopic[];
|
|
1769
|
+
};
|
|
1770
|
+
export type StreamFailureDetails = {
|
|
1771
|
+
kind: "barrier" | "published_but_unconfirmed" | "catch_up";
|
|
1772
|
+
code: string;
|
|
1773
|
+
message: string;
|
|
1774
|
+
retryable: boolean;
|
|
1775
|
+
intentId: number | null;
|
|
1776
|
+
publishedIntentIds: number[];
|
|
1777
|
+
summary: {
|
|
1778
|
+
messages: bigint;
|
|
1779
|
+
conversations: bigint;
|
|
1780
|
+
failed: bigint;
|
|
1781
|
+
completed: boolean;
|
|
1782
|
+
} | null;
|
|
1783
|
+
barriers: StreamBarrierFailure[];
|
|
1784
|
+
};
|
|
1785
|
+
/**
|
|
1786
|
+
* Reads structured progress from a stream, sync, or publication error.
|
|
1787
|
+
* All sequence values are exact bigints. Invalid or absent details return undefined.
|
|
1788
|
+
* A published-but-unconfirmed error does not mean that publication failed.
|
|
1789
|
+
*/
|
|
1790
|
+
export declare const getStreamFailureDetails: (error: unknown) => StreamFailureDetails | undefined;
|
|
1791
|
+
//#endregion
|
|
1792
|
+
//#region src/ServerConfiguration.d.ts
|
|
1793
|
+
/**
|
|
1794
|
+
* Typed failures for the deployment configuration a backend publishes
|
|
1795
|
+
* (spec 006 §7).
|
|
1796
|
+
*
|
|
1797
|
+
* The bindings report every one of these as an `Error` whose message begins
|
|
1798
|
+
* with `[ClientError::<Variant>]`. Matching on that string is what this module
|
|
1799
|
+
* removes: each of the six documented codes becomes its own class, so an app
|
|
1800
|
+
* writes `error instanceof BackendMismatchError` instead of a regular
|
|
1801
|
+
* expression over a message that may be reworded.
|
|
1802
|
+
*
|
|
1803
|
+
* Every class keeps the binding's message and the original error as `cause`,
|
|
1804
|
+
* so the identifiers, versions, scopes, or chain the core reported are still
|
|
1805
|
+
* readable for diagnostics.
|
|
1806
|
+
*/
|
|
1807
|
+
/**
|
|
1808
|
+
* Base class of the six configuration failures. Catch this to handle any of
|
|
1809
|
+
* them; catch a subclass to handle one.
|
|
1810
|
+
*/
|
|
1811
|
+
export declare class ServerConfigurationError extends Error {
|
|
1812
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1813
|
+
readonly code: string;
|
|
1814
|
+
constructor(
|
|
1815
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1816
|
+
code: string, message: string, options?: ErrorOptions);
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* The configuration could not be read: the deployment did not answer, answered
|
|
1820
|
+
* `UNIMPLEMENTED` because it predates spec 006, or the copy could not be
|
|
1821
|
+
* stored.
|
|
1822
|
+
*/
|
|
1823
|
+
export declare class ConfigurationUnavailableError extends ServerConfigurationError {
|
|
1824
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* The deployment answered with a configuration no client can use: an empty or
|
|
1828
|
+
* malformed identifier, an unparseable minimum version, or a chain that is not
|
|
1829
|
+
* a CAIP-2 identifier. Nothing is stored.
|
|
1830
|
+
*/
|
|
1831
|
+
export declare class ConfigurationInvalidError extends ServerConfigurationError {
|
|
1832
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* This database is bound to a different deployment. The identifier the backend
|
|
1836
|
+
* published is not the one the database was created against. Recovery is a
|
|
1837
|
+
* database created for the deployment the app now uses.
|
|
1838
|
+
*/
|
|
1839
|
+
export declare class BackendMismatchError extends ServerConfigurationError {
|
|
1840
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1841
|
+
}
|
|
1842
|
+
/** The deployment requires a newer libxmtp than this SDK is built on. */
|
|
1843
|
+
export declare class ClientVersionTooOldError extends ServerConfigurationError {
|
|
1844
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* The deployment requires authentication and no credential source was
|
|
1848
|
+
* configured. The message carries the scopes it requires.
|
|
1849
|
+
*/
|
|
1850
|
+
export declare class AuthRequiredError extends ServerConfigurationError {
|
|
1851
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* A smart contract wallet signature names a chain the deployment does not
|
|
1855
|
+
* verify on. Raised before any network call, and only for signatures the app
|
|
1856
|
+
* supplied.
|
|
1857
|
+
*/
|
|
1858
|
+
export declare class ChainNotAcceptedError extends ServerConfigurationError {
|
|
1859
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Classifies an error from any SDK call as one of the six configuration
|
|
1863
|
+
* failures, or `undefined` when it is something else.
|
|
1864
|
+
*
|
|
1865
|
+
* Use this where the SDK hands back the raw error, for instance a
|
|
1866
|
+
* `ChainNotAcceptedError` raised deep inside a call that supplies a smart
|
|
1867
|
+
* contract wallet signature.
|
|
1868
|
+
*/
|
|
1869
|
+
export declare const toServerConfigurationError: (error: unknown) => ServerConfigurationError | undefined;
|
|
1870
|
+
/**
|
|
1871
|
+
* Rethrows an error as its typed configuration failure, or unchanged when it
|
|
1872
|
+
* is not one.
|
|
1873
|
+
*/
|
|
1874
|
+
export declare const throwServerConfigurationError: (error: unknown) => never;
|
|
1875
|
+
//#endregion
|
|
1876
|
+
export { type Action, ActionStyle, type Actions, type ApiStats, type AppDataChange, type ArchiveMetadata, type ArchiveOptions, type AsyncStreamProxy, type Attachment, type AuthCallback, type AuthConfiguration, type Backend, type BackendBuilder, BackupElementSelectionOption, type BuiltInContentTypes, type ClientOptions, type Consent, ConsentEntityType, ConsentState, type ContentOptions, ContentType, type ConversationDebugInfo, type ConversationListItem, ConversationType, type CreateDmOptions, type CreateGroupOptions, type Credential, type Cursor, type DEFAULT_RETRY_ATTEMPTS, type DEFAULT_RETRY_DELAY, type DeliveryCursor, DeliveryStatus, type DeviceSyncOptions, type DistributiveOmit, type EOASigner, type EncryptedAttachment, type EnrichedReply, type ExtractCodecContentTypes, type GetBlockNumber, type GetChainId, type GetIdentifier, type GroupMember, GroupMembershipState, GroupMessageKind, type GroupMetadata, type GroupPermissions, GroupPermissionsOptions, type GroupSyncSummary, type GroupUpdated, type HmacKey, type Identifier, IdentifierKind, type IdentityStats, type Inbox, type InboxState, type Installation, type Intent, type KeyPackageStatus, type LeaveRequest, type Lifetime, type LimitsConfiguration, type ListConversationsOptions, ListConversationsOrderBy, type ListMessagesOptions, LogLevel, type LogOptions, type Message, type MessageAcknowledgement, type MessageCatchUp, type MessageCatchUpGeneration, type MessageDelivery, type MessageDisappearingSettings, type MessageHistorySnapshot, type MessageReaderSource, MessageSortBy, type MessageTopicStatus, MetadataField, type MetadataFieldChange, type MlsConfiguration, type MultiRemoteAttachment, type NetworkOptions, type NotificationChannel, type NotificationConfig, type NotificationOverride, type NotificationState, type OtherOptions, PermissionLevel, PermissionPolicy, type PermissionPolicySet, PermissionUpdateType, type Reaction, ReactionAction, ReactionSchema, type ReadReceipt, type RemoteAttachment, type Reply, type ResolveValue, type RetentionConfiguration, type SCWSigner, type SendMessageOpts, type SendOpts, type ServerConfiguration, type SignMessage, type SignatureRequestHandle, type Signer, type SigningKeyDescription, SortDirection, type StorageOptions, type StreamCallback, type StreamFunction, type StreamOptions, type StreamValueMutator, type TransactionMetadata, type TransactionReference, type UserPreferenceUpdate, type VisibilityConfirmationOptions, type WalletCall, type WalletSendCalls, type WorkerConfigOptions, type WorkerIntervalOverride, type WorkerJitterOverride, WorkerKind, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, type createStream, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, flushTelemetry, initLogging };
|
|
1877
|
+
//# sourceMappingURL=index.d.ts.map
|