@xmtp/node-sdk 6.1.0 → 6.2.0-dev.4b7b477
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 +23 -3
- package/dist/index.d.ts +395 -280
- package/dist/index.js +1180 -492
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
|
|
2
2
|
import * as _xmtp_node_bindings from '@xmtp/node-bindings';
|
|
3
|
-
import { ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions,
|
|
4
|
-
export { Action, ActionStyle, Actions, ApiStats, ArchiveMetadata, ArchiveOptions, Attachment,
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Pre-configured URLs for the XMTP network based on the environment
|
|
8
|
-
*
|
|
9
|
-
* @deprecated Use `createBackend()` instead.
|
|
10
|
-
* @constant
|
|
11
|
-
* @property {string} local - The local URL for the XMTP network
|
|
12
|
-
* @property {string} dev - The development URL for the XMTP network
|
|
13
|
-
* @property {string} production - The production URL for the XMTP network
|
|
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
|
-
};
|
|
3
|
+
import { DeliveryCursor, ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions, AppDataChange, Identifier, StreamCloser, ConversationType, ConsentState, MessageCatchUp, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, ArchiveOptions, ArchiveMetadata, GroupSyncSummary, ServerConfiguration } from '@xmtp/node-bindings';
|
|
4
|
+
export { Action, ActionStyle, Actions, ApiStats, AppDataChange, ArchiveMetadata, ArchiveOptions, Attachment, AuthConfiguration, Backend, BackendBuilder, BackupElementSelectionOption, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryCursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, LimitsConfiguration, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageCatchUp, MessageCatchUpGeneration, MessageDisappearingSettings, MessageHistorySnapshot, MessageSortBy, MessageTopicStatus, MetadataField, MetadataFieldChange, MlsConfiguration, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, Reply, RetentionConfiguration, SendMessageOpts, SendOpts, ServerConfiguration, SignatureRequestHandle, SigningKeyDescription, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, VisibilityConfirmationOptions, WalletCall, WalletSendCalls, WorkerConfigOptions, 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';
|
|
37
5
|
|
|
38
6
|
declare class CodecRegistry {
|
|
39
7
|
#private;
|
|
@@ -67,6 +35,8 @@ declare class CodecRegistry {
|
|
|
67
35
|
* @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
68
36
|
*/
|
|
69
37
|
declare class DecodedMessage<ContentTypes = unknown> {
|
|
38
|
+
/** Database-local position of this delivery. Absent for ordinary history reads. */
|
|
39
|
+
deliveryCursor?: DeliveryCursor;
|
|
70
40
|
content: ContentTypes | undefined;
|
|
71
41
|
contentType: ContentTypeId$1;
|
|
72
42
|
conversationId: string;
|
|
@@ -88,49 +58,33 @@ type HexString = `0x${string}`;
|
|
|
88
58
|
declare function isHexString(value: unknown): value is HexString;
|
|
89
59
|
declare function validHex(value: unknown): HexString;
|
|
90
60
|
|
|
91
|
-
/**
|
|
92
|
-
* XMTP environment
|
|
93
|
-
*/
|
|
94
|
-
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
95
61
|
/**
|
|
96
62
|
* Network options
|
|
97
63
|
*/
|
|
64
|
+
/** A backend credential. Include the `Bearer ` prefix when required. */
|
|
65
|
+
type Credential = {
|
|
66
|
+
/** Header name. Defaults to `authorization`. */
|
|
67
|
+
name?: string;
|
|
68
|
+
value: string;
|
|
69
|
+
/** Expiration as Unix seconds. Must be a safe integer. */
|
|
70
|
+
expiresAtSeconds: number;
|
|
71
|
+
};
|
|
72
|
+
/** Called when the backend needs a credential, including credential refresh. */
|
|
73
|
+
type AuthCallback = () => Promise<Credential>;
|
|
98
74
|
type NetworkOptions = {
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
env?: XmtpEnv;
|
|
105
|
-
/**
|
|
106
|
-
* apiUrl can be used to override the `env` flag and connect to a
|
|
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
|
-
*/
|
|
75
|
+
/** Backend URL, including the HTTP or HTTPS scheme. */
|
|
76
|
+
backendUrl: string;
|
|
77
|
+
/** Label used only for the default database file name. */
|
|
78
|
+
env?: string;
|
|
79
|
+
/** Custom app version. */
|
|
121
80
|
appVersion?: string;
|
|
81
|
+
/** Supply backend credentials. Separate from the XMTP identity signer. */
|
|
82
|
+
authCallback?: AuthCallback;
|
|
122
83
|
};
|
|
123
84
|
/**
|
|
124
85
|
* Device sync options
|
|
125
86
|
*/
|
|
126
87
|
type DeviceSyncOptions = {
|
|
127
|
-
/**
|
|
128
|
-
* historySyncUrl can be used to override the `env` flag and connect to a
|
|
129
|
-
* specific endpoint for syncing history
|
|
130
|
-
*
|
|
131
|
-
* @see https://docs.xmtp.org/chat-apps/list-stream-sync/history-sync
|
|
132
|
-
*/
|
|
133
|
-
historySyncUrl?: string | null;
|
|
134
88
|
/**
|
|
135
89
|
* Disable device sync
|
|
136
90
|
*/
|
|
@@ -147,8 +101,8 @@ type StorageOptions = {
|
|
|
147
101
|
*
|
|
148
102
|
* - `undefined` (or excluded from the client options)
|
|
149
103
|
* The database will be created in the current working directory and is based on
|
|
150
|
-
* the
|
|
151
|
-
* Example: `xmtp-
|
|
104
|
+
* the environment label and client inbox ID.
|
|
105
|
+
* Example: `xmtp-default-<inbox-id>.db3`
|
|
152
106
|
*
|
|
153
107
|
* - `null`
|
|
154
108
|
* No database will be created and all data will be lost once the client disconnects.
|
|
@@ -165,7 +119,7 @@ type StorageOptions = {
|
|
|
165
119
|
/**
|
|
166
120
|
* Encryption key for the local DB (32 bytes, hex)
|
|
167
121
|
*
|
|
168
|
-
* @see https://docs.xmtp.org/
|
|
122
|
+
* @see https://docs.xmtp.org/sdk/client/#view-an-encrypted-database
|
|
169
123
|
*/
|
|
170
124
|
dbEncryptionKey?: Uint8Array | HexString;
|
|
171
125
|
/**
|
|
@@ -220,6 +174,10 @@ type OtherOptions = {
|
|
|
220
174
|
* Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
|
|
221
175
|
*/
|
|
222
176
|
otelEndpoint?: string;
|
|
177
|
+
/** Service name attached to exported telemetry. */
|
|
178
|
+
otelServiceName?: string;
|
|
179
|
+
/** Fraction of root spans sampled, from 0 to 1. */
|
|
180
|
+
otelSampleRatio?: number;
|
|
223
181
|
/**
|
|
224
182
|
* Resource attributes attached to all exported telemetry spans
|
|
225
183
|
* (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
|
|
@@ -246,10 +204,26 @@ type OtherOptions = {
|
|
|
246
204
|
/**
|
|
247
205
|
* Options for waiting until client registration is visible on the network.
|
|
248
206
|
*
|
|
249
|
-
* When set, `registerIdentity`
|
|
250
|
-
* to confirm the registration before resolving.
|
|
207
|
+
* When set, `registerIdentity` waits until the backend can read the registration.
|
|
251
208
|
*/
|
|
252
209
|
waitForRegistrationVisible?: VisibilityConfirmationOptions;
|
|
210
|
+
/**
|
|
211
|
+
* Unstable: notifications for group state changes, for clients that
|
|
212
|
+
* reconcile a group's `appData` themselves.
|
|
213
|
+
*
|
|
214
|
+
* Only `appData` exists today; callbacks for the other mutable fields will
|
|
215
|
+
* be added as further optional properties. Registered at client creation
|
|
216
|
+
* because the changes they report arrive from the stream and sync paths,
|
|
217
|
+
* where no SDK call is on the stack to carry them.
|
|
218
|
+
*
|
|
219
|
+
* The `appData` callback is awaited before message processing continues, so
|
|
220
|
+
* a semantic merge — including republishing via `updateAppData` — can finish
|
|
221
|
+
* first. It fires for changes this client made as well as remote ones, so
|
|
222
|
+
* the merge must be idempotent.
|
|
223
|
+
*/
|
|
224
|
+
unstableChangeCallbacks?: {
|
|
225
|
+
appData?: (change: AppDataChange) => Promise<void>;
|
|
226
|
+
};
|
|
253
227
|
};
|
|
254
228
|
type ClientOptions = (NetworkOptions | {
|
|
255
229
|
backend: Backend;
|
|
@@ -270,8 +244,7 @@ type EnrichedReply<T = unknown, U = unknown> = {
|
|
|
270
244
|
type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
|
|
271
245
|
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
|
|
272
246
|
|
|
273
|
-
declare const
|
|
274
|
-
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
247
|
+
declare const createBackend: (options: NetworkOptions) => Promise<Backend>;
|
|
275
248
|
|
|
276
249
|
declare class InboxReassignError extends Error {
|
|
277
250
|
constructor();
|
|
@@ -333,6 +306,11 @@ interface AsyncStreamProxy<T> extends AsyncIterable<T> {
|
|
|
333
306
|
|
|
334
307
|
declare const DEFAULT_RETRY_DELAY = 60000;
|
|
335
308
|
declare const DEFAULT_RETRY_ATTEMPTS = 10;
|
|
309
|
+
/**
|
|
310
|
+
* Notification streams created by createStream use the retry settings and hooks.
|
|
311
|
+
* Durable message streams use onValue, onError, and onEnd. Core handles their
|
|
312
|
+
* network recovery; notification retry settings and hooks do not apply.
|
|
313
|
+
*/
|
|
336
314
|
type StreamOptions<T = unknown, V = T> = {
|
|
337
315
|
/**
|
|
338
316
|
* Called when the stream ends
|
|
@@ -343,38 +321,41 @@ type StreamOptions<T = unknown, V = T> = {
|
|
|
343
321
|
*/
|
|
344
322
|
onError?: (error: Error) => void;
|
|
345
323
|
/**
|
|
346
|
-
* Called when
|
|
324
|
+
* Called when a notification stream fails
|
|
347
325
|
*/
|
|
348
326
|
onFail?: () => void;
|
|
349
327
|
/**
|
|
350
|
-
* Called when
|
|
328
|
+
* Called when a notification stream is restarted
|
|
351
329
|
*/
|
|
352
330
|
onRestart?: () => void;
|
|
353
331
|
/**
|
|
354
|
-
* Called when
|
|
332
|
+
* Called when a notification stream is retried
|
|
355
333
|
*/
|
|
356
334
|
onRetry?: (attempts: number, maxAttempts: number) => void;
|
|
357
335
|
/**
|
|
358
|
-
* Called when a value is emitted from the stream
|
|
336
|
+
* Called when a value is emitted from the stream.
|
|
337
|
+
* For message streams, this selects callback mode. Do not also iterate that stream.
|
|
338
|
+
* Message delivery is acknowledged after this callback returns successfully.
|
|
359
339
|
*/
|
|
360
|
-
onValue?: (value: V) => void
|
|
340
|
+
onValue?: (value: V) => void | Promise<void>;
|
|
361
341
|
/**
|
|
362
|
-
* The number of times to retry
|
|
342
|
+
* The number of times to retry a notification stream
|
|
363
343
|
* (default: 10)
|
|
364
344
|
*/
|
|
365
345
|
retryAttempts?: number;
|
|
366
346
|
/**
|
|
367
|
-
* The delay between retries (in milliseconds)
|
|
347
|
+
* The delay between notification stream retries (in milliseconds)
|
|
368
348
|
* (default: 60000)
|
|
369
349
|
*/
|
|
370
350
|
retryDelay?: number;
|
|
371
351
|
/**
|
|
372
|
-
* Whether to retry
|
|
352
|
+
* Whether to retry a notification stream if it fails
|
|
373
353
|
* (default: true)
|
|
374
354
|
*/
|
|
375
355
|
retryOnFail?: boolean;
|
|
376
356
|
/**
|
|
377
|
-
* Whether to
|
|
357
|
+
* Whether to skip pre-sync for notification streams.
|
|
358
|
+
* Durable message readers start receipt without a separate pre-sync.
|
|
378
359
|
* (default: false)
|
|
379
360
|
*/
|
|
380
361
|
disableSync?: boolean;
|
|
@@ -387,12 +368,14 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
|
|
|
387
368
|
*
|
|
388
369
|
* If the stream fails, an attempt will be made to restart it.
|
|
389
370
|
*
|
|
371
|
+
* Ending the stream is terminal: no callbacks are invoked and no native
|
|
372
|
+
* stream is created after the stream ends.
|
|
373
|
+
*
|
|
390
374
|
* This function is not intended to be used directly.
|
|
391
375
|
*
|
|
392
376
|
* @param streamFunction - The stream function to create a stream from
|
|
393
377
|
* @param streamValueMutator - An optional function to mutate the value emitted from the stream
|
|
394
378
|
* @param options - The options for the stream
|
|
395
|
-
* @param args - Additional arguments to pass to the stream function
|
|
396
379
|
* @returns An async iterable stream proxy
|
|
397
380
|
* @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true
|
|
398
381
|
* @throws {StreamFailedError} if the stream fails and can't be restarted
|
|
@@ -415,6 +398,81 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
|
|
|
415
398
|
declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
|
|
416
399
|
declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
417
400
|
|
|
401
|
+
type MessageAcknowledgement = {
|
|
402
|
+
checkOwner(): boolean | Promise<boolean>;
|
|
403
|
+
acknowledge(): void | Promise<void>;
|
|
404
|
+
reject(): void | Promise<void>;
|
|
405
|
+
};
|
|
406
|
+
type MessageDelivery<T> = {
|
|
407
|
+
message: T;
|
|
408
|
+
cursor: DeliveryCursor;
|
|
409
|
+
acknowledgement: MessageAcknowledgement;
|
|
410
|
+
};
|
|
411
|
+
type MessageReaderSource<T> = {
|
|
412
|
+
nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;
|
|
413
|
+
close(): void | Promise<void>;
|
|
414
|
+
updateScope(groupIds?: string[]): void | Promise<void>;
|
|
415
|
+
updateFilter(conversationType?: ConversationType, consentStates?: ConsentState[]): void | Promise<void>;
|
|
416
|
+
catchUpSnapshot(): MessageCatchUp | Promise<MessageCatchUp>;
|
|
417
|
+
catchUpChanged(): Promise<MessageCatchUp>;
|
|
418
|
+
};
|
|
419
|
+
/** One pending item. Construction selects callback mode or next-request acknowledgement. */
|
|
420
|
+
declare class MessageStream<T, V> implements AsyncIterable<V> {
|
|
421
|
+
#private;
|
|
422
|
+
constructor(reader: MessageReaderSource<T>, convert: (message: T, cursor: DeliveryCursor) => V | undefined | Promise<V | undefined>, options?: StreamOptions<T, V>);
|
|
423
|
+
get isDone(): boolean;
|
|
424
|
+
get deliveredCursor(): DeliveryCursor | undefined;
|
|
425
|
+
next: () => Promise<IteratorResult<V, undefined>>;
|
|
426
|
+
return: () => Promise<IteratorReturnResult<undefined>>;
|
|
427
|
+
end: () => Promise<IteratorReturnResult<undefined>>;
|
|
428
|
+
updateScope: (groupIds?: string[]) => void | Promise<void>;
|
|
429
|
+
updateFilter: (conversationType?: ConversationType, consentStates?: ConsentState[]) => void | Promise<void>;
|
|
430
|
+
catchUpSnapshot: () => MessageCatchUp | Promise<MessageCatchUp>;
|
|
431
|
+
catchUpChanged: () => Promise<MessageCatchUp>;
|
|
432
|
+
[Symbol.asyncIterator](): this;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** Delivery channel for this installation. */
|
|
436
|
+
type NotificationChannel = {
|
|
437
|
+
type: "apns";
|
|
438
|
+
token: string;
|
|
439
|
+
} | {
|
|
440
|
+
type: "fcm";
|
|
441
|
+
token: string;
|
|
442
|
+
} | {
|
|
443
|
+
type: "http";
|
|
444
|
+
url: string;
|
|
445
|
+
signingKey: Uint8Array;
|
|
446
|
+
};
|
|
447
|
+
/** Notification delivery and conversation rules. */
|
|
448
|
+
type NotificationConfig = {
|
|
449
|
+
channel: NotificationChannel;
|
|
450
|
+
/** Defaults to Allowed. An empty list selects no consent states. */
|
|
451
|
+
consentStates?: ConsentState[];
|
|
452
|
+
/** Defaults to true. */
|
|
453
|
+
includeWelcomes?: boolean;
|
|
454
|
+
/** Defaults to false. */
|
|
455
|
+
includeSyncGroups?: boolean;
|
|
456
|
+
/** Defaults to false. */
|
|
457
|
+
includeCommits?: boolean;
|
|
458
|
+
};
|
|
459
|
+
/** Reset to the configured consent rules with "default". */
|
|
460
|
+
type NotificationOverride = "enabled" | "disabled" | "default";
|
|
461
|
+
/** A notification failure with a stable error code. */
|
|
462
|
+
declare class NotificationError extends Error {
|
|
463
|
+
readonly code: string;
|
|
464
|
+
constructor(code: string, options?: ErrorOptions);
|
|
465
|
+
}
|
|
466
|
+
/** Local notification state. Reading it makes no backend request. */
|
|
467
|
+
type NotificationState = {
|
|
468
|
+
state: "disabled";
|
|
469
|
+
} | {
|
|
470
|
+
state: "enabled";
|
|
471
|
+
} | {
|
|
472
|
+
state: "failed";
|
|
473
|
+
error: NotificationError;
|
|
474
|
+
};
|
|
475
|
+
|
|
418
476
|
/**
|
|
419
477
|
* Represents a conversation
|
|
420
478
|
*
|
|
@@ -438,6 +496,10 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
438
496
|
* Gets whether this conversation is currently active
|
|
439
497
|
*/
|
|
440
498
|
get isActive(): boolean;
|
|
499
|
+
/** Override notification rules, or reset the override with "default". */
|
|
500
|
+
setNotifications(value: NotificationOverride): Promise<void>;
|
|
501
|
+
/** Read the effective notification value for this conversation. */
|
|
502
|
+
notificationsEnabled(): Promise<boolean>;
|
|
441
503
|
/**
|
|
442
504
|
* Gets the inbox ID that added this client's inbox to the conversation
|
|
443
505
|
*/
|
|
@@ -480,12 +542,19 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
480
542
|
*/
|
|
481
543
|
sync(): Promise<void>;
|
|
482
544
|
/**
|
|
483
|
-
*
|
|
545
|
+
* Reads retained messages after the default acknowledgement position.
|
|
546
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
547
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
548
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
484
549
|
*
|
|
485
|
-
* @param options - Optional
|
|
550
|
+
* @param options - Optional delivery callbacks and replay cursor
|
|
486
551
|
* @returns Stream instance for new messages
|
|
487
552
|
*/
|
|
488
|
-
stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>>
|
|
553
|
+
stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
554
|
+
from?: DeliveryCursor;
|
|
555
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
556
|
+
messageHistorySnapshot(limit: number): _xmtp_node_bindings.MessageHistorySnapshot;
|
|
557
|
+
beginningDeliveryCursor(): DeliveryCursor;
|
|
489
558
|
/**
|
|
490
559
|
* Decodes, decrypts, and persists a raw envelope from a group message stream.
|
|
491
560
|
*
|
|
@@ -756,8 +825,15 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
|
756
825
|
* Updates the group's app data (max 8192 bytes)
|
|
757
826
|
*
|
|
758
827
|
* @param appData The new app data for the group
|
|
828
|
+
* @param expectedAppData Optional compare-and-swap guard. When provided, the
|
|
829
|
+
* update is abandoned — rather than overwriting — if the committed value is
|
|
830
|
+
* no longer this, including when another member's commit wins the race after
|
|
831
|
+
* this update was published. Callers reconciling structured state should
|
|
832
|
+
* pass the value they merged against, so a concurrent write surfaces as an
|
|
833
|
+
* error instead of silently discarding someone else's change. Omit for
|
|
834
|
+
* last-writer-wins.
|
|
759
835
|
*/
|
|
760
|
-
updateAppData(appData: string): Promise<void>;
|
|
836
|
+
updateAppData(appData: string, expectedAppData?: string): Promise<void>;
|
|
761
837
|
/**
|
|
762
838
|
* The permissions of the group
|
|
763
839
|
*/
|
|
@@ -800,13 +876,13 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
|
800
876
|
*
|
|
801
877
|
* @param identifiers Array of member identifiers to add
|
|
802
878
|
*/
|
|
803
|
-
addMembersByIdentifiers(identifiers: Identifier[]): Promise<
|
|
879
|
+
addMembersByIdentifiers(identifiers: Identifier[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
|
|
804
880
|
/**
|
|
805
881
|
* Adds members to the group using inbox IDs
|
|
806
882
|
*
|
|
807
883
|
* @param inboxIds Array of inbox IDs to add
|
|
808
884
|
*/
|
|
809
|
-
addMembers(inboxIds: string[]): Promise<
|
|
885
|
+
addMembers(inboxIds: string[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
|
|
810
886
|
/**
|
|
811
887
|
* Removes members from the group using identifiers
|
|
812
888
|
*
|
|
@@ -876,7 +952,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
876
952
|
*
|
|
877
953
|
* @param id - The conversation ID to look up
|
|
878
954
|
* @returns The conversation if found, undefined otherwise
|
|
879
|
-
* @see https://docs.xmtp.org/
|
|
955
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
880
956
|
*/
|
|
881
957
|
getConversationById(id: string): Promise<Group<ContentTypes> | Dm<ContentTypes> | undefined>;
|
|
882
958
|
/**
|
|
@@ -884,7 +960,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
884
960
|
*
|
|
885
961
|
* @param inboxId - The inbox ID to look up
|
|
886
962
|
* @returns The DM if found, undefined otherwise
|
|
887
|
-
* @see https://docs.xmtp.org/
|
|
963
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
888
964
|
*/
|
|
889
965
|
getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
|
|
890
966
|
/**
|
|
@@ -892,7 +968,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
892
968
|
*
|
|
893
969
|
* @param identifier - The identifier to look up
|
|
894
970
|
* @returns Promise that resolves with the DM, if found
|
|
895
|
-
* @see https://docs.xmtp.org/
|
|
971
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
896
972
|
*/
|
|
897
973
|
fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
|
|
898
974
|
/**
|
|
@@ -900,7 +976,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
900
976
|
*
|
|
901
977
|
* @param id - The message ID to look up
|
|
902
978
|
* @returns The decoded message if found, undefined otherwise
|
|
903
|
-
* @see https://docs.xmtp.org/
|
|
979
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
904
980
|
*/
|
|
905
981
|
getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
|
|
906
982
|
/**
|
|
@@ -908,7 +984,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
908
984
|
*
|
|
909
985
|
* @param options - Optional group creation options
|
|
910
986
|
* @returns The new group
|
|
911
|
-
* @see https://docs.xmtp.org/
|
|
987
|
+
* @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group
|
|
912
988
|
*/
|
|
913
989
|
createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
|
|
914
990
|
/**
|
|
@@ -917,7 +993,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
917
993
|
* @param identifiers - Array of identifiers for group members
|
|
918
994
|
* @param options - Optional group creation options
|
|
919
995
|
* @returns The new group
|
|
920
|
-
* @see https://docs.xmtp.org/
|
|
996
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
921
997
|
*/
|
|
922
998
|
createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
923
999
|
/**
|
|
@@ -926,7 +1002,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
926
1002
|
* @param inboxIds - Array of inbox IDs for group members
|
|
927
1003
|
* @param options - Optional group creation options
|
|
928
1004
|
* @returns The new group
|
|
929
|
-
* @see https://docs.xmtp.org/
|
|
1005
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
930
1006
|
*/
|
|
931
1007
|
createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
932
1008
|
/**
|
|
@@ -935,7 +1011,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
935
1011
|
* @param identifier - Identifier for the DM recipient
|
|
936
1012
|
* @param options - Optional DM creation options
|
|
937
1013
|
* @returns The new DM
|
|
938
|
-
* @see https://docs.xmtp.org/
|
|
1014
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
939
1015
|
*/
|
|
940
1016
|
createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
941
1017
|
/**
|
|
@@ -944,7 +1020,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
944
1020
|
* @param inboxId - Inbox ID for the DM recipient
|
|
945
1021
|
* @param options - Optional DM creation options
|
|
946
1022
|
* @returns The new DM
|
|
947
|
-
* @see https://docs.xmtp.org/
|
|
1023
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
948
1024
|
*/
|
|
949
1025
|
createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
950
1026
|
/**
|
|
@@ -952,7 +1028,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
952
1028
|
*
|
|
953
1029
|
* @param options - Optional filtering and pagination options
|
|
954
1030
|
* @returns Array of conversations
|
|
955
|
-
* @see https://docs.xmtp.org/
|
|
1031
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
956
1032
|
*/
|
|
957
1033
|
list(options?: ListConversationsOptions): Promise<(Group<ContentTypes> | Dm<ContentTypes>)[]>;
|
|
958
1034
|
/**
|
|
@@ -960,7 +1036,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
960
1036
|
*
|
|
961
1037
|
* @param options - Optional filtering and pagination options
|
|
962
1038
|
* @returns Array of groups
|
|
963
|
-
* @see https://docs.xmtp.org/
|
|
1039
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
964
1040
|
*/
|
|
965
1041
|
listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Group<ContentTypes>[];
|
|
966
1042
|
/**
|
|
@@ -968,14 +1044,14 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
968
1044
|
*
|
|
969
1045
|
* @param options - Optional filtering and pagination options
|
|
970
1046
|
* @returns Array of DMs
|
|
971
|
-
* @see https://docs.xmtp.org/
|
|
1047
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
972
1048
|
*/
|
|
973
1049
|
listDms(options?: Omit<ListConversationsOptions, "conversationType">): Dm<ContentTypes>[];
|
|
974
1050
|
/**
|
|
975
1051
|
* Synchronizes conversations for the current client from the network
|
|
976
1052
|
*
|
|
977
1053
|
* @returns Promise that resolves when sync is complete
|
|
978
|
-
* @see https://docs.xmtp.org/
|
|
1054
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
979
1055
|
*/
|
|
980
1056
|
sync(): Promise<void>;
|
|
981
1057
|
/**
|
|
@@ -984,7 +1060,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
984
1060
|
*
|
|
985
1061
|
* @param consentStates - Optional array of consent states to filter by
|
|
986
1062
|
* @returns Promise that resolves when sync is complete
|
|
987
|
-
* @see https://docs.xmtp.org/
|
|
1063
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
988
1064
|
*/
|
|
989
1065
|
syncAll(consentStates?: ConsentState[]): Promise<_xmtp_node_bindings.GroupSyncSummary>;
|
|
990
1066
|
/**
|
|
@@ -993,7 +1069,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
993
1069
|
* @param options - Optional stream options
|
|
994
1070
|
* @param options.conversationType - Optional conversation type to filter by
|
|
995
1071
|
* @returns Stream instance for new conversations
|
|
996
|
-
* @see https://docs.xmtp.org/
|
|
1072
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
997
1073
|
*/
|
|
998
1074
|
stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
|
|
999
1075
|
conversationType?: ConversationType;
|
|
@@ -1003,7 +1079,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1003
1079
|
*
|
|
1004
1080
|
* @param options - Optional stream options
|
|
1005
1081
|
* @returns Stream instance for new group conversations
|
|
1006
|
-
* @see https://docs.xmtp.org/
|
|
1082
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1007
1083
|
*/
|
|
1008
1084
|
streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
|
|
1009
1085
|
/**
|
|
@@ -1011,44 +1087,59 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1011
1087
|
*
|
|
1012
1088
|
* @param options - Optional stream options
|
|
1013
1089
|
* @returns Stream instance for new DM conversations
|
|
1014
|
-
* @see https://docs.xmtp.org/
|
|
1090
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1015
1091
|
*/
|
|
1016
1092
|
streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
|
|
1017
1093
|
/**
|
|
1018
|
-
*
|
|
1094
|
+
* Reads retained messages after each group's default acknowledgement position.
|
|
1095
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
1096
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
1097
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
1019
1098
|
*
|
|
1020
1099
|
* @param options - Optional stream options
|
|
1021
1100
|
* @param options.conversationType - Optional conversation type to filter by
|
|
1022
1101
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1023
1102
|
* @returns Stream instance for new messages
|
|
1024
|
-
* @see https://docs.xmtp.org/
|
|
1103
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1025
1104
|
*/
|
|
1026
1105
|
streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1027
1106
|
conversationType?: ConversationType;
|
|
1028
1107
|
consentStates?: ConsentState[];
|
|
1029
|
-
|
|
1108
|
+
groupIds?: string[];
|
|
1109
|
+
from?: DeliveryCursor;
|
|
1110
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1111
|
+
messageHistorySnapshot(limit: number, options?: {
|
|
1112
|
+
groupIds?: string[];
|
|
1113
|
+
conversationType?: ConversationType;
|
|
1114
|
+
consentStates?: ConsentState[];
|
|
1115
|
+
}): _xmtp_node_bindings.MessageHistorySnapshot;
|
|
1116
|
+
beginningDeliveryCursor(): DeliveryCursor;
|
|
1030
1117
|
/**
|
|
1031
|
-
*
|
|
1118
|
+
* Reads retained group messages with default progress or an explicit replay cursor.
|
|
1032
1119
|
*
|
|
1033
1120
|
* @param options - Optional stream options
|
|
1034
1121
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1035
1122
|
* @returns Stream instance for new group messages
|
|
1036
|
-
* @see https://docs.xmtp.org/
|
|
1123
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1037
1124
|
*/
|
|
1038
1125
|
streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1039
1126
|
consentStates?: ConsentState[];
|
|
1040
|
-
|
|
1127
|
+
groupIds?: string[];
|
|
1128
|
+
from?: DeliveryCursor;
|
|
1129
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1041
1130
|
/**
|
|
1042
|
-
*
|
|
1131
|
+
* Reads retained DM messages with default progress or an explicit replay cursor.
|
|
1043
1132
|
*
|
|
1044
1133
|
* @param options - Optional stream options
|
|
1045
1134
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1046
1135
|
* @returns Stream instance for new DM messages
|
|
1047
|
-
* @see https://docs.xmtp.org/
|
|
1136
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1048
1137
|
*/
|
|
1049
1138
|
streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1050
1139
|
consentStates?: ConsentState[];
|
|
1051
|
-
|
|
1140
|
+
groupIds?: string[];
|
|
1141
|
+
from?: DeliveryCursor;
|
|
1142
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1052
1143
|
/**
|
|
1053
1144
|
* Creates a stream for message deletions that streams the message IDs of
|
|
1054
1145
|
* deleted messages
|
|
@@ -1075,7 +1166,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1075
1166
|
* Gets the HMAC keys for all conversations
|
|
1076
1167
|
*
|
|
1077
1168
|
* @returns The HMAC keys for all conversations
|
|
1078
|
-
* @see https://docs.xmtp.org/
|
|
1169
|
+
* @see https://docs.xmtp.org/sdk/push-notifications/
|
|
1079
1170
|
*/
|
|
1080
1171
|
hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
|
|
1081
1172
|
}
|
|
@@ -1197,7 +1288,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1197
1288
|
* @param options - Optional configuration for the client
|
|
1198
1289
|
* @returns A new client instance
|
|
1199
1290
|
*/
|
|
1200
|
-
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options
|
|
1291
|
+
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1201
1292
|
codecs?: ContentCodecs;
|
|
1202
1293
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1203
1294
|
/**
|
|
@@ -1210,7 +1301,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1210
1301
|
* @param options - Optional configuration for the client
|
|
1211
1302
|
* @returns A new client instance
|
|
1212
1303
|
*/
|
|
1213
|
-
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options
|
|
1304
|
+
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1214
1305
|
codecs?: ContentCodecs;
|
|
1215
1306
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1216
1307
|
/**
|
|
@@ -1222,11 +1313,11 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1222
1313
|
*/
|
|
1223
1314
|
get appVersion(): string | undefined;
|
|
1224
1315
|
/**
|
|
1225
|
-
* Gets the
|
|
1316
|
+
* Gets the label used for the default database file name
|
|
1226
1317
|
*
|
|
1227
1318
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1228
1319
|
*/
|
|
1229
|
-
get env():
|
|
1320
|
+
get env(): string;
|
|
1230
1321
|
/**
|
|
1231
1322
|
* Gets the client options
|
|
1232
1323
|
*/
|
|
@@ -1467,27 +1558,8 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1467
1558
|
* @throws {SignerUnavailableError} if no signer is available
|
|
1468
1559
|
*/
|
|
1469
1560
|
revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
|
|
1470
|
-
/**
|
|
1471
|
-
|
|
1472
|
-
*
|
|
1473
|
-
* @param signer - The signer to use
|
|
1474
|
-
* @param inboxId - The inbox ID to revoke installations for
|
|
1475
|
-
* @param installationIds - The installation IDs to revoke
|
|
1476
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1477
|
-
*/
|
|
1478
|
-
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], backend?: Backend): Promise<void>;
|
|
1479
|
-
/**
|
|
1480
|
-
* Revokes specific installations of the client's inbox without a client
|
|
1481
|
-
*
|
|
1482
|
-
* @param signer - The signer to use
|
|
1483
|
-
* @param inboxId - The inbox ID to revoke installations for
|
|
1484
|
-
* @param installationIds - The installation IDs to revoke
|
|
1485
|
-
* @param env - The environment to use
|
|
1486
|
-
* @param gatewayHost - Optional gateway host
|
|
1487
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1488
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1489
|
-
*/
|
|
1490
|
-
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
1561
|
+
/** Revoke installations with an explicit backend or network options. */
|
|
1562
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], optionsOrBackend: NetworkOptions | Backend): Promise<void>;
|
|
1491
1563
|
/**
|
|
1492
1564
|
* Changes the recovery identifier for the client's inbox
|
|
1493
1565
|
*
|
|
@@ -1556,66 +1628,12 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1556
1628
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1557
1629
|
*/
|
|
1558
1630
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
1559
|
-
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
* @returns The inbox states for the specified inbox IDs
|
|
1566
|
-
*/
|
|
1567
|
-
static fetchInboxStates(inboxIds: string[], backend?: Backend): Promise<InboxState[]>;
|
|
1568
|
-
/**
|
|
1569
|
-
* Fetches the inbox states for the specified inbox IDs from the network
|
|
1570
|
-
* without a client
|
|
1571
|
-
*
|
|
1572
|
-
* @param inboxIds - The inbox IDs to get the state for
|
|
1573
|
-
* @param env - The environment to use
|
|
1574
|
-
* @param gatewayHost - Optional gateway host
|
|
1575
|
-
* @returns The inbox states for the specified inbox IDs
|
|
1576
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1577
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1578
|
-
*/
|
|
1579
|
-
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
|
|
1580
|
-
/**
|
|
1581
|
-
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
1582
|
-
* without a client
|
|
1583
|
-
*
|
|
1584
|
-
* @param inboxIds - The inbox IDs to check
|
|
1585
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1586
|
-
* @returns Map of inbox IDs to their updates count
|
|
1587
|
-
*/
|
|
1588
|
-
static fetchLatestInboxUpdatesCount(inboxIds: string[], backendOrEnv?: Backend | XmtpEnv): Promise<Map<string, number>>;
|
|
1589
|
-
/**
|
|
1590
|
-
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
1591
|
-
* without a client
|
|
1592
|
-
*
|
|
1593
|
-
* @param inboxIds - The inbox IDs to check
|
|
1594
|
-
* @param env - The environment to use
|
|
1595
|
-
* @param gatewayHost - Optional gateway host
|
|
1596
|
-
* @returns Map of inbox IDs to their updates count
|
|
1597
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1598
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1599
|
-
*/
|
|
1600
|
-
static fetchLatestInboxUpdatesCount(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<Map<string, number>>;
|
|
1601
|
-
/**
|
|
1602
|
-
* Checks if the specified identifiers can be messaged
|
|
1603
|
-
*
|
|
1604
|
-
* @param identifiers - The identifiers to check
|
|
1605
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1606
|
-
* @returns Map of identifiers to whether they can be messaged
|
|
1607
|
-
*/
|
|
1608
|
-
static canMessage(identifiers: Identifier[], backend?: Backend): Promise<Map<string, boolean>>;
|
|
1609
|
-
/**
|
|
1610
|
-
* Checks if the specified identifiers can be messaged
|
|
1611
|
-
*
|
|
1612
|
-
* @param identifiers - The identifiers to check
|
|
1613
|
-
* @param env - Optional XMTP environment
|
|
1614
|
-
* @returns Map of identifiers to whether they can be messaged
|
|
1615
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1616
|
-
* of `XmtpEnv`.
|
|
1617
|
-
*/
|
|
1618
|
-
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
1631
|
+
/** Fetch inbox states with an explicit backend or network options. */
|
|
1632
|
+
static fetchInboxStates(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<_xmtp_node_bindings.InboxState[]>;
|
|
1633
|
+
/** Fetch inbox update counts with an explicit backend or network options. */
|
|
1634
|
+
static fetchLatestInboxUpdatesCount(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, number>>;
|
|
1635
|
+
/** Check identifiers with an explicit backend or network options. */
|
|
1636
|
+
static canMessage(identifiers: Identifier[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, boolean>>;
|
|
1619
1637
|
/**
|
|
1620
1638
|
* Verifies a signature was made with a public key
|
|
1621
1639
|
*
|
|
@@ -1625,82 +1643,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1625
1643
|
* @returns Whether the signature is valid
|
|
1626
1644
|
*/
|
|
1627
1645
|
static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
1628
|
-
/**
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
* @param address - The address to check
|
|
1633
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1634
|
-
* @returns Whether the address is authorized
|
|
1635
|
-
*/
|
|
1636
|
-
static isAddressAuthorized(inboxId: string, address: string, backend?: Backend): Promise<boolean>;
|
|
1637
|
-
/**
|
|
1638
|
-
* Checks if an address is authorized for an inbox
|
|
1639
|
-
*
|
|
1640
|
-
* @param inboxId - The inbox ID to check
|
|
1641
|
-
* @param address - The address to check
|
|
1642
|
-
* @param env - The environment to use
|
|
1643
|
-
* @param gatewayHost - Optional gateway host
|
|
1644
|
-
* @returns Whether the address is authorized
|
|
1645
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1646
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1647
|
-
*/
|
|
1648
|
-
static isAddressAuthorized(inboxId: string, address: string, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1649
|
-
/**
|
|
1650
|
-
* Checks if an installation is authorized for an inbox
|
|
1651
|
-
*
|
|
1652
|
-
* @param inboxId - The inbox ID to check
|
|
1653
|
-
* @param installation - The installation to check
|
|
1654
|
-
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1655
|
-
* @returns Whether the installation is authorized
|
|
1656
|
-
*/
|
|
1657
|
-
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, backend?: Backend): Promise<boolean>;
|
|
1658
|
-
/**
|
|
1659
|
-
* Checks if an installation is authorized for an inbox
|
|
1660
|
-
*
|
|
1661
|
-
* @param inboxId - The inbox ID to check
|
|
1662
|
-
* @param installation - The installation to check
|
|
1663
|
-
* @param env - The environment to use
|
|
1664
|
-
* @param gatewayHost - Optional gateway host
|
|
1665
|
-
* @returns Whether the installation is authorized
|
|
1666
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1667
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
1668
|
-
*/
|
|
1669
|
-
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1670
|
-
/**
|
|
1671
|
-
* Send a sync request to other devices on the network
|
|
1672
|
-
*
|
|
1673
|
-
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
1674
|
-
* @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
|
|
1675
|
-
* @returns Promise that resolves when the sync request is sent
|
|
1676
|
-
*/
|
|
1677
|
-
sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
1678
|
-
/**
|
|
1679
|
-
* Send a sync archive to the sync group
|
|
1680
|
-
*
|
|
1681
|
-
* @param pin - The pin used for reference when importing
|
|
1682
|
-
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
1683
|
-
* @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
|
|
1684
|
-
* @returns Promise that resolves when the sync archive is sent
|
|
1685
|
-
*/
|
|
1686
|
-
sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
1687
|
-
/**
|
|
1688
|
-
* Process a sync archive that matches the pin given
|
|
1689
|
-
*
|
|
1690
|
-
* @param archivePin - Optional pin to match. If not provided, processes the last archive sent
|
|
1691
|
-
* @returns Promise that resolves when the archive is processed
|
|
1692
|
-
*/
|
|
1693
|
-
processSyncArchive(archivePin?: string | null): Promise<void>;
|
|
1694
|
-
/**
|
|
1695
|
-
* List the archives available for import in the sync group
|
|
1696
|
-
*
|
|
1697
|
-
* You may need to manually sync the sync group before calling
|
|
1698
|
-
* this function to see recently uploaded archives.
|
|
1699
|
-
*
|
|
1700
|
-
* @param daysCutoff - Number of days to look back for archives
|
|
1701
|
-
* @returns Array of available archive information
|
|
1702
|
-
*/
|
|
1703
|
-
listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[];
|
|
1646
|
+
/** Check address authorization with an explicit backend or network options. */
|
|
1647
|
+
static isAddressAuthorized(inboxId: string, address: string, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
|
|
1648
|
+
/** Check installation authorization with an explicit backend or network options. */
|
|
1649
|
+
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
|
|
1704
1650
|
/**
|
|
1705
1651
|
* Archive application elements to file for later restoration
|
|
1706
1652
|
*
|
|
@@ -1734,7 +1680,176 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1734
1680
|
* @returns Promise that resolves with a summary of the sync operation
|
|
1735
1681
|
*/
|
|
1736
1682
|
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
|
|
1683
|
+
/** Enable notifications and register the delivery channel. */
|
|
1684
|
+
enableNotifications(config: NotificationConfig): Promise<NotificationState>;
|
|
1685
|
+
/** Disable notifications. Per-conversation overrides remain stored. */
|
|
1686
|
+
disableNotifications(): Promise<void>;
|
|
1687
|
+
/** Read the local state without a backend request. */
|
|
1688
|
+
notificationState(): Promise<NotificationState>;
|
|
1689
|
+
/**
|
|
1690
|
+
* What the deployment published about itself, as this client resolved it
|
|
1691
|
+
* when it was built.
|
|
1692
|
+
*
|
|
1693
|
+
* Reads memory and makes no backend request. The value never changes for the
|
|
1694
|
+
* life of the client: a background refresh rewrites the stored copy, and a
|
|
1695
|
+
* new value takes effect at the next build.
|
|
1696
|
+
*
|
|
1697
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1698
|
+
*/
|
|
1699
|
+
serverConfiguration(): ServerConfiguration;
|
|
1700
|
+
/**
|
|
1701
|
+
* Fetch the deployment configuration now, rewrite the stored copy, and
|
|
1702
|
+
* return what was fetched.
|
|
1703
|
+
*
|
|
1704
|
+
* The snapshot this client holds is unchanged; use it to observe a change an
|
|
1705
|
+
* operator has made without restarting.
|
|
1706
|
+
*
|
|
1707
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1708
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1709
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1710
|
+
* @throws {BackendMismatchError} if it published a different identifier
|
|
1711
|
+
* @throws {ClientVersionTooOldError} if it now requires a newer libxmtp
|
|
1712
|
+
*/
|
|
1713
|
+
refreshServerConfiguration(): Promise<ServerConfiguration>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Read what a deployment publishes about itself with no database, no client,
|
|
1716
|
+
* and no credential.
|
|
1717
|
+
*
|
|
1718
|
+
* Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted
|
|
1719
|
+
* smart contract wallet chains before it decides how to build a client.
|
|
1720
|
+
* Nothing is stored and no identifier binding is applied.
|
|
1721
|
+
*
|
|
1722
|
+
* @param target - A backend URL, network options, or an existing backend
|
|
1723
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1724
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1725
|
+
*/
|
|
1726
|
+
static fetchServerConfiguration(target: string | NetworkOptions | Backend): Promise<ServerConfiguration>;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
type StreamFailureCause = {
|
|
1730
|
+
kind: "target_pending" | "receipt_pending" | "processing_pending" | "blocked" | "storage" | "receiver" | "invalid_topic";
|
|
1731
|
+
code: string | null;
|
|
1732
|
+
message: string;
|
|
1733
|
+
retryable: boolean;
|
|
1734
|
+
};
|
|
1735
|
+
type UnfinishedStreamTopic = {
|
|
1736
|
+
topic: Uint8Array;
|
|
1737
|
+
/** Null means that target capture did not complete. */
|
|
1738
|
+
target: bigint | null;
|
|
1739
|
+
received: bigint;
|
|
1740
|
+
processed: bigint;
|
|
1741
|
+
unresolvedWelcomes: bigint[];
|
|
1742
|
+
inactive: boolean;
|
|
1743
|
+
cause: StreamFailureCause | null;
|
|
1744
|
+
};
|
|
1745
|
+
type StreamBarrierFailure = {
|
|
1746
|
+
reason: "blocked" | "deadline" | "cancelled";
|
|
1747
|
+
unfinished: UnfinishedStreamTopic[];
|
|
1748
|
+
};
|
|
1749
|
+
type StreamFailureDetails = {
|
|
1750
|
+
kind: "barrier" | "published_but_unconfirmed" | "catch_up";
|
|
1751
|
+
code: string;
|
|
1752
|
+
message: string;
|
|
1753
|
+
retryable: boolean;
|
|
1754
|
+
intentId: number | null;
|
|
1755
|
+
publishedIntentIds: number[];
|
|
1756
|
+
summary: {
|
|
1757
|
+
messages: bigint;
|
|
1758
|
+
conversations: bigint;
|
|
1759
|
+
failed: bigint;
|
|
1760
|
+
completed: boolean;
|
|
1761
|
+
} | null;
|
|
1762
|
+
barriers: StreamBarrierFailure[];
|
|
1763
|
+
};
|
|
1764
|
+
/**
|
|
1765
|
+
* Reads structured progress from a stream, sync, or publication error.
|
|
1766
|
+
* All sequence values are exact bigints. Invalid or absent details return undefined.
|
|
1767
|
+
* A published-but-unconfirmed error does not mean that publication failed.
|
|
1768
|
+
*/
|
|
1769
|
+
declare const getStreamFailureDetails: (error: unknown) => StreamFailureDetails | undefined;
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Typed failures for the deployment configuration a backend publishes
|
|
1773
|
+
* (spec 006 §7).
|
|
1774
|
+
*
|
|
1775
|
+
* The bindings report every one of these as an `Error` whose message begins
|
|
1776
|
+
* with `[ClientError::<Variant>]`. Matching on that string is what this module
|
|
1777
|
+
* removes: each of the six documented codes becomes its own class, so an app
|
|
1778
|
+
* writes `error instanceof BackendMismatchError` instead of a regular
|
|
1779
|
+
* expression over a message that may be reworded.
|
|
1780
|
+
*
|
|
1781
|
+
* Every class keeps the binding's message and the original error as `cause`,
|
|
1782
|
+
* so the identifiers, versions, scopes, or chain the core reported are still
|
|
1783
|
+
* readable for diagnostics.
|
|
1784
|
+
*/
|
|
1785
|
+
/**
|
|
1786
|
+
* Base class of the six configuration failures. Catch this to handle any of
|
|
1787
|
+
* them; catch a subclass to handle one.
|
|
1788
|
+
*/
|
|
1789
|
+
declare class ServerConfigurationError extends Error {
|
|
1790
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1791
|
+
readonly code: string;
|
|
1792
|
+
constructor(
|
|
1793
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1794
|
+
code: string, message: string, options?: ErrorOptions);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* The configuration could not be read: the deployment did not answer, answered
|
|
1798
|
+
* `UNIMPLEMENTED` because it predates spec 006, or the copy could not be
|
|
1799
|
+
* stored.
|
|
1800
|
+
*/
|
|
1801
|
+
declare class ConfigurationUnavailableError extends ServerConfigurationError {
|
|
1802
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* The deployment answered with a configuration no client can use: an empty or
|
|
1806
|
+
* malformed identifier, an unparseable minimum version, or a chain that is not
|
|
1807
|
+
* a CAIP-2 identifier. Nothing is stored.
|
|
1808
|
+
*/
|
|
1809
|
+
declare class ConfigurationInvalidError extends ServerConfigurationError {
|
|
1810
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* This database is bound to a different deployment. The identifier the backend
|
|
1814
|
+
* published is not the one the database was created against. Recovery is a
|
|
1815
|
+
* database created for the deployment the app now uses.
|
|
1816
|
+
*/
|
|
1817
|
+
declare class BackendMismatchError extends ServerConfigurationError {
|
|
1818
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1819
|
+
}
|
|
1820
|
+
/** The deployment requires a newer libxmtp than this SDK is built on. */
|
|
1821
|
+
declare class ClientVersionTooOldError extends ServerConfigurationError {
|
|
1822
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* The deployment requires authentication and no credential source was
|
|
1826
|
+
* configured. The message carries the scopes it requires.
|
|
1827
|
+
*/
|
|
1828
|
+
declare class AuthRequiredError extends ServerConfigurationError {
|
|
1829
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* A smart contract wallet signature names a chain the deployment does not
|
|
1833
|
+
* verify on. Raised before any network call, and only for signatures the app
|
|
1834
|
+
* supplied.
|
|
1835
|
+
*/
|
|
1836
|
+
declare class ChainNotAcceptedError extends ServerConfigurationError {
|
|
1837
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1737
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Classifies an error from any SDK call as one of the six configuration
|
|
1841
|
+
* failures, or `undefined` when it is something else.
|
|
1842
|
+
*
|
|
1843
|
+
* Use this where the SDK hands back the raw error, for instance a
|
|
1844
|
+
* `ChainNotAcceptedError` raised deep inside a call that supplies a smart
|
|
1845
|
+
* contract wallet signature.
|
|
1846
|
+
*/
|
|
1847
|
+
declare const toServerConfigurationError: (error: unknown) => ServerConfigurationError | undefined;
|
|
1848
|
+
/**
|
|
1849
|
+
* Rethrows an error as its typed configuration failure, or unchanged when it
|
|
1850
|
+
* is not one.
|
|
1851
|
+
*/
|
|
1852
|
+
declare const throwServerConfigurationError: (error: unknown) => never;
|
|
1738
1853
|
|
|
1739
|
-
export { AccountAlreadyAssociatedError,
|
|
1740
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator,
|
|
1854
|
+
export { AccountAlreadyAssociatedError, AuthRequiredError, BackendMismatchError, ChainNotAcceptedError, Client, ClientNotInitializedError, ClientVersionTooOldError, CodecRegistry, ConfigurationInvalidError, ConfigurationUnavailableError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DebugInformation, DecodedMessage, Dm, Group, InboxReassignError, MessageStream, MissingContentTypeError, NotificationError, Preferences, ServerConfigurationError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createBackend, createStream, generateInboxId, getInboxIdForIdentifier, getStreamFailureDetails, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, throwServerConfigurationError, toServerConfigurationError, validHex };
|
|
1855
|
+
export type { AsyncStreamProxy, AuthCallback, BuiltInContentTypes, ClientOptions, ContentOptions, Credential, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, GetBlockNumber, GetChainId, GetIdentifier, HexString, MessageAcknowledgement, MessageDelivery, MessageReaderSource, NetworkOptions, NotificationChannel, NotificationConfig, NotificationOverride, NotificationState, OtherOptions, ResolveValue, SCWSigner, SignMessage, Signer, StorageOptions, StreamBarrierFailure, StreamCallback, StreamFailureCause, StreamFailureDetails, StreamFunction, StreamOptions, StreamValueMutator, UnfinishedStreamTopic };
|