@xmtp/node-sdk 5.5.0 → 6.0.0-dev.3f65d25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +308 -54
- package/dist/index.js +387 -135
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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, LogLevel, Identifier, StreamCloser, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, Reply, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle } from '@xmtp/node-bindings';
|
|
4
|
-
export { Action, ActionStyle, Actions, ApiStats, Attachment, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MessageSortBy, MetadataField, MetadataFieldChange, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment,
|
|
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, XmtpEnv as XmtpEnv$1, Identifier, StreamCloser, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, InboxState, ArchiveOptions, AvailableArchiveInfo, ArchiveMetadata, GroupSyncSummary } from '@xmtp/node-bindings';
|
|
4
|
+
export { Action, ActionStyle, Actions, ApiStats, ArchiveMetadata, ArchiveOptions, Attachment, AvailableArchiveInfo, Backend, BackendBuilder, BackupElementSelectionOption, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MessageSortBy, MetadataField, MetadataFieldChange, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, Reply, SendMessageOpts, SendOpts, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, VisibilityConfirmationOptions, WalletCall, WalletSendCalls, WorkerConfigOptions, WorkerIntervalOverride, 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';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Pre-configured URLs for the XMTP network based on the environment
|
|
8
8
|
*
|
|
9
|
+
* @deprecated Use `createBackend()` instead.
|
|
9
10
|
* @constant
|
|
10
11
|
* @property {string} local - The local URL for the XMTP network
|
|
11
12
|
* @property {string} dev - The development URL for the XMTP network
|
|
@@ -28,6 +29,10 @@ declare const HistorySyncUrls: {
|
|
|
28
29
|
readonly local: "http://localhost:5558";
|
|
29
30
|
readonly dev: "https://message-history.dev.ephemera.network";
|
|
30
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";
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
declare class CodecRegistry {
|
|
@@ -86,7 +91,7 @@ declare function validHex(value: unknown): HexString;
|
|
|
86
91
|
/**
|
|
87
92
|
* XMTP environment
|
|
88
93
|
*/
|
|
89
|
-
type XmtpEnv =
|
|
94
|
+
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
90
95
|
/**
|
|
91
96
|
* Network options
|
|
92
97
|
*/
|
|
@@ -102,6 +107,23 @@ type NetworkOptions = {
|
|
|
102
107
|
* specific endpoint
|
|
103
108
|
*/
|
|
104
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;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Device sync options
|
|
125
|
+
*/
|
|
126
|
+
type DeviceSyncOptions = {
|
|
105
127
|
/**
|
|
106
128
|
* historySyncUrl can be used to override the `env` flag and connect to a
|
|
107
129
|
* specific endpoint for syncing history
|
|
@@ -110,13 +132,9 @@ type NetworkOptions = {
|
|
|
110
132
|
*/
|
|
111
133
|
historySyncUrl?: string | null;
|
|
112
134
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* Only valid for `testnet` and `mainnet` environments
|
|
116
|
-
*
|
|
117
|
-
* @see:https://docs.xmtp.org/fund-agents-apps/run-gateway
|
|
135
|
+
* Disable device sync
|
|
118
136
|
*/
|
|
119
|
-
|
|
137
|
+
disableDeviceSync?: boolean;
|
|
120
138
|
};
|
|
121
139
|
/**
|
|
122
140
|
* Storage options
|
|
@@ -150,6 +168,26 @@ type StorageOptions = {
|
|
|
150
168
|
* @see https://docs.xmtp.org/chat-apps/core-messaging/create-a-client#view-an-encrypted-database
|
|
151
169
|
*/
|
|
152
170
|
dbEncryptionKey?: Uint8Array | HexString;
|
|
171
|
+
/**
|
|
172
|
+
* Maximum number of connections in the local DB connection pool.
|
|
173
|
+
*
|
|
174
|
+
* Defaults to 25 when unset. Ignored when `useSingleConnection` is `true`.
|
|
175
|
+
*/
|
|
176
|
+
maxDbPoolSize?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Minimum number of connections kept warm in the local DB connection pool.
|
|
179
|
+
*
|
|
180
|
+
* Defaults to 5 when unset. Ignored when `useSingleConnection` is `true`.
|
|
181
|
+
*/
|
|
182
|
+
minDbPoolSize?: number;
|
|
183
|
+
/**
|
|
184
|
+
* When `true`, the native DB uses a single connection (one file descriptor)
|
|
185
|
+
* instead of a pool. The pool-size options above are ignored. Intended for
|
|
186
|
+
* services running many clients in one process.
|
|
187
|
+
*
|
|
188
|
+
* Defaults to `false` (pooled).
|
|
189
|
+
*/
|
|
190
|
+
useSingleConnection?: boolean;
|
|
153
191
|
};
|
|
154
192
|
type ContentOptions = {
|
|
155
193
|
/**
|
|
@@ -163,28 +201,66 @@ type OtherOptions = {
|
|
|
163
201
|
*/
|
|
164
202
|
structuredLogging?: boolean;
|
|
165
203
|
/**
|
|
166
|
-
* Logging level
|
|
204
|
+
* Logging level. Also the level exported to OTLP when `otelEndpoint` is set.
|
|
167
205
|
*/
|
|
168
206
|
loggingLevel?: LogLevel;
|
|
169
207
|
/**
|
|
170
|
-
*
|
|
208
|
+
* Level for the stdout console layer only. Defaults to `loggingLevel`. Set to
|
|
209
|
+
* `LogLevel.Warn` to quiet stdout below the OTLP export level — e.g. so a log
|
|
210
|
+
* shipper does not duplicate logs already exported via OTLP, while OTLP still
|
|
211
|
+
* receives `loggingLevel`.
|
|
171
212
|
*/
|
|
172
|
-
|
|
213
|
+
stdoutLoggingLevel?: LogLevel;
|
|
173
214
|
/**
|
|
174
|
-
*
|
|
215
|
+
* OTLP endpoint (e.g. `"http://collector:4317"`) for exporting telemetry
|
|
216
|
+
* spans and logs. When set, spans (and `tracing` events as correlated logs)
|
|
217
|
+
* are exported via OTLP to this endpoint, where a downstream OpenTelemetry
|
|
218
|
+
* Collector can derive metrics from the spans and forward the logs.
|
|
219
|
+
*
|
|
220
|
+
* Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
|
|
175
221
|
*/
|
|
176
|
-
|
|
222
|
+
otelEndpoint?: string;
|
|
177
223
|
/**
|
|
178
|
-
*
|
|
224
|
+
* Resource attributes attached to all exported telemetry spans
|
|
225
|
+
* (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
|
|
226
|
+
* Use these to attribute telemetry to its source.
|
|
179
227
|
*/
|
|
180
|
-
|
|
228
|
+
resourceAttributes?: Record<string, string>;
|
|
229
|
+
/**
|
|
230
|
+
* Tuning for the background worker scheduler (intervals, jitter, per-worker
|
|
231
|
+
* overrides, and disabled workers). All fields are optional; omitting this
|
|
232
|
+
* object preserves the default worker behavior.
|
|
233
|
+
*
|
|
234
|
+
* Intervals are specified in nanoseconds.
|
|
235
|
+
*/
|
|
236
|
+
workerConfig?: WorkerConfigOptions;
|
|
237
|
+
/**
|
|
238
|
+
* Disable automatic registration when creating a client
|
|
239
|
+
*/
|
|
240
|
+
disableAutoRegister?: boolean;
|
|
181
241
|
/**
|
|
182
242
|
* The nonce to use when generating an inbox ID
|
|
183
243
|
* (default: undefined = 1)
|
|
184
244
|
*/
|
|
185
245
|
nonce?: bigint;
|
|
246
|
+
/**
|
|
247
|
+
* Options for waiting until client registration is visible on the network.
|
|
248
|
+
*
|
|
249
|
+
* When set, `registerIdentity` will wait for the specified quorum of nodes
|
|
250
|
+
* to confirm the registration before resolving.
|
|
251
|
+
*/
|
|
252
|
+
waitForRegistrationVisible?: VisibilityConfirmationOptions;
|
|
186
253
|
};
|
|
187
|
-
type ClientOptions = NetworkOptions
|
|
254
|
+
type ClientOptions = (NetworkOptions | {
|
|
255
|
+
backend: Backend;
|
|
256
|
+
}) & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions;
|
|
257
|
+
/**
|
|
258
|
+
* `Omit` that distributes over unions. The built-in `Omit` collapses a union
|
|
259
|
+
* (e.g. `ClientOptions`' `NetworkOptions | { backend }` arm) because
|
|
260
|
+
* `keyof (A | B)` only yields shared keys. This preserves each arm, so options
|
|
261
|
+
* like `{ backend }` survive `Omit<ClientOptions, "codecs">`.
|
|
262
|
+
*/
|
|
263
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
188
264
|
type EnrichedReply<T = unknown, U = unknown> = {
|
|
189
265
|
referenceId: string;
|
|
190
266
|
content: T;
|
|
@@ -194,6 +270,9 @@ type EnrichedReply<T = unknown, U = unknown> = {
|
|
|
194
270
|
type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
|
|
195
271
|
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
|
|
196
272
|
|
|
273
|
+
declare const envToString: (env: XmtpEnv$1) => XmtpEnv;
|
|
274
|
+
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
275
|
+
|
|
197
276
|
declare class InboxReassignError extends Error {
|
|
198
277
|
constructor();
|
|
199
278
|
}
|
|
@@ -217,7 +296,7 @@ declare class StreamInvalidRetryAttemptsError extends Error {
|
|
|
217
296
|
}
|
|
218
297
|
|
|
219
298
|
declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => string;
|
|
220
|
-
declare const getInboxIdForIdentifier: (
|
|
299
|
+
declare const getInboxIdForIdentifier: (backend: Backend, identifier: Identifier) => Promise<string | null>;
|
|
221
300
|
|
|
222
301
|
type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
|
|
223
302
|
type GetIdentifier = () => Promise<Identifier> | Identifier;
|
|
@@ -427,8 +506,10 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
427
506
|
* @param sendOptions - Options for sending the message
|
|
428
507
|
* @param sendOptions.shouldPush - Indicates whether this message should be
|
|
429
508
|
* included in push notifications
|
|
430
|
-
* @param sendOptions.
|
|
509
|
+
* @param sendOptions.optimistic - Indicates whether this message should be
|
|
431
510
|
* sent optimistically and published later via `publishMessages`
|
|
511
|
+
* @param sendOptions.idempotencyKey - Optional idempotency key; re-sending
|
|
512
|
+
* identical content with the same key produces the same deduplicated message id
|
|
432
513
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
433
514
|
*/
|
|
434
515
|
send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts): Promise<string>;
|
|
@@ -436,98 +517,97 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
436
517
|
* Sends a text message
|
|
437
518
|
*
|
|
438
519
|
* @param text - The text to send
|
|
439
|
-
* @param
|
|
520
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
440
521
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
441
522
|
*/
|
|
442
|
-
sendText(text: string,
|
|
523
|
+
sendText(text: string, opts?: SendOpts): Promise<string>;
|
|
443
524
|
/**
|
|
444
525
|
* Sends a markdown message
|
|
445
526
|
*
|
|
446
527
|
* @param markdown - The markdown to send
|
|
447
|
-
* @param
|
|
528
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
448
529
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
449
530
|
*/
|
|
450
|
-
sendMarkdown(markdown: string,
|
|
531
|
+
sendMarkdown(markdown: string, opts?: SendOpts): Promise<string>;
|
|
451
532
|
/**
|
|
452
533
|
* Sends a reaction message
|
|
453
534
|
*
|
|
454
535
|
* @param reaction - The reaction to send
|
|
455
|
-
* @param
|
|
536
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
456
537
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
457
538
|
*/
|
|
458
|
-
sendReaction(reaction: Reaction,
|
|
539
|
+
sendReaction(reaction: Reaction, opts?: SendOpts): Promise<string>;
|
|
459
540
|
/**
|
|
460
541
|
* Sends a read receipt message
|
|
461
542
|
*
|
|
462
|
-
* @param
|
|
463
|
-
* @param isOptimistic - Whether to send the message optimistically
|
|
543
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
464
544
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
465
545
|
*/
|
|
466
|
-
sendReadReceipt(
|
|
546
|
+
sendReadReceipt(opts?: SendOpts): Promise<string>;
|
|
467
547
|
/**
|
|
468
548
|
* Sends a reply message
|
|
469
549
|
*
|
|
470
550
|
* @param reply - The reply to send
|
|
471
|
-
* @param
|
|
551
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
472
552
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
473
553
|
*/
|
|
474
|
-
sendReply(reply: Reply,
|
|
554
|
+
sendReply(reply: Reply, opts?: SendOpts): Promise<string>;
|
|
475
555
|
/**
|
|
476
556
|
* Sends a transaction reference message
|
|
477
557
|
*
|
|
478
558
|
* @param transactionReference - The transaction reference to send
|
|
479
|
-
* @param
|
|
559
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
480
560
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
481
561
|
*/
|
|
482
|
-
sendTransactionReference(transactionReference: TransactionReference,
|
|
562
|
+
sendTransactionReference(transactionReference: TransactionReference, opts?: SendOpts): Promise<string>;
|
|
483
563
|
/**
|
|
484
564
|
* Sends a wallet send calls message
|
|
485
565
|
*
|
|
486
566
|
* @param walletSendCalls - The wallet send calls to send
|
|
487
|
-
* @param
|
|
567
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
488
568
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
489
569
|
*/
|
|
490
|
-
sendWalletSendCalls(walletSendCalls: WalletSendCalls,
|
|
570
|
+
sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts): Promise<string>;
|
|
491
571
|
/**
|
|
492
572
|
* Sends a actions message
|
|
493
573
|
*
|
|
494
574
|
* @param actions - The actions to send
|
|
495
|
-
* @param
|
|
575
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
496
576
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
497
577
|
*/
|
|
498
|
-
sendActions(actions: Actions,
|
|
578
|
+
sendActions(actions: Actions, opts?: SendOpts): Promise<string>;
|
|
499
579
|
/**
|
|
500
580
|
* Sends a intent message
|
|
501
581
|
*
|
|
502
582
|
* @param intent - The intent to send
|
|
503
|
-
* @param
|
|
583
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
504
584
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
505
585
|
*/
|
|
506
|
-
sendIntent(intent: Intent,
|
|
586
|
+
sendIntent(intent: Intent, opts?: SendOpts): Promise<string>;
|
|
507
587
|
/**
|
|
508
588
|
* Sends an attachment message
|
|
509
589
|
*
|
|
510
590
|
* @param attachment - The attachment to send
|
|
511
|
-
* @param
|
|
591
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
512
592
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
513
593
|
*/
|
|
514
|
-
sendAttachment(attachment: Attachment,
|
|
594
|
+
sendAttachment(attachment: Attachment, opts?: SendOpts): Promise<string>;
|
|
515
595
|
/**
|
|
516
596
|
* Sends a multi remote attachment message
|
|
517
597
|
*
|
|
518
598
|
* @param multiRemoteAttachment - The multi remote attachment to send
|
|
519
|
-
* @param
|
|
599
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
520
600
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
521
601
|
*/
|
|
522
|
-
sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment,
|
|
602
|
+
sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, opts?: SendOpts): Promise<string>;
|
|
523
603
|
/**
|
|
524
604
|
* Sends a remote attachment message
|
|
525
605
|
*
|
|
526
606
|
* @param remoteAttachment - The remote attachment to send
|
|
527
|
-
* @param
|
|
607
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
528
608
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
529
609
|
*/
|
|
530
|
-
sendRemoteAttachment(remoteAttachment: RemoteAttachment,
|
|
610
|
+
sendRemoteAttachment(remoteAttachment: RemoteAttachment, opts?: SendOpts): Promise<string>;
|
|
531
611
|
/**
|
|
532
612
|
* Lists messages in this conversation
|
|
533
613
|
*
|
|
@@ -1117,7 +1197,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1117
1197
|
* @param options - Optional configuration for the client
|
|
1118
1198
|
* @returns A new client instance
|
|
1119
1199
|
*/
|
|
1120
|
-
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options?:
|
|
1200
|
+
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options?: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1121
1201
|
codecs?: ContentCodecs;
|
|
1122
1202
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1123
1203
|
/**
|
|
@@ -1130,7 +1210,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1130
1210
|
* @param options - Optional configuration for the client
|
|
1131
1211
|
* @returns A new client instance
|
|
1132
1212
|
*/
|
|
1133
|
-
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options?:
|
|
1213
|
+
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options?: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1134
1214
|
codecs?: ContentCodecs;
|
|
1135
1215
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1136
1216
|
/**
|
|
@@ -1141,6 +1221,12 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1141
1221
|
* Gets the app version used by the client
|
|
1142
1222
|
*/
|
|
1143
1223
|
get appVersion(): string | undefined;
|
|
1224
|
+
/**
|
|
1225
|
+
* Gets the XMTP environment the client is connected to
|
|
1226
|
+
*
|
|
1227
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1228
|
+
*/
|
|
1229
|
+
get env(): XmtpEnv;
|
|
1144
1230
|
/**
|
|
1145
1231
|
* Gets the client options
|
|
1146
1232
|
*/
|
|
@@ -1189,6 +1275,19 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1189
1275
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1190
1276
|
*/
|
|
1191
1277
|
get preferences(): Preferences;
|
|
1278
|
+
/**
|
|
1279
|
+
* Cleanly shuts down the client: cancels in-flight workers and detached
|
|
1280
|
+
* streams, then releases the database connection.
|
|
1281
|
+
*
|
|
1282
|
+
* This is idempotent — calling it more than once resolves without error.
|
|
1283
|
+
* Await this before deleting the database file or dropping the client
|
|
1284
|
+
* reference to avoid log noise from background tasks running against a
|
|
1285
|
+
* closed database.
|
|
1286
|
+
*
|
|
1287
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1288
|
+
* @returns Promise that resolves when the client has shut down
|
|
1289
|
+
*/
|
|
1290
|
+
close(): Promise<void>;
|
|
1192
1291
|
/**
|
|
1193
1292
|
* Adds a signature to a signature request using the client's signer (or the
|
|
1194
1293
|
* provided signer)
|
|
@@ -1371,10 +1470,22 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1371
1470
|
/**
|
|
1372
1471
|
* Revokes specific installations of the client's inbox without a client
|
|
1373
1472
|
*
|
|
1374
|
-
* @param env - The environment to use
|
|
1375
1473
|
* @param signer - The signer to use
|
|
1376
1474
|
* @param inboxId - The inbox ID to revoke installations for
|
|
1377
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`.
|
|
1378
1489
|
*/
|
|
1379
1490
|
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
1380
1491
|
/**
|
|
@@ -1395,6 +1506,21 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1395
1506
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1396
1507
|
*/
|
|
1397
1508
|
canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
1511
|
+
*
|
|
1512
|
+
* @param inboxIds - The inbox IDs to check
|
|
1513
|
+
* @returns Map of inbox IDs to their updates count
|
|
1514
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1515
|
+
*/
|
|
1516
|
+
fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Fetches the latest inbox updates count for the client's inbox
|
|
1519
|
+
*
|
|
1520
|
+
* @returns The latest inbox updates count
|
|
1521
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1522
|
+
*/
|
|
1523
|
+
fetchOwnInboxUpdatesCount(): Promise<number>;
|
|
1398
1524
|
/**
|
|
1399
1525
|
* Fetches the key package statuses from the network for the specified
|
|
1400
1526
|
* installation IDs
|
|
@@ -1434,17 +1560,60 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1434
1560
|
* Fetches the inbox states for the specified inbox IDs from the network
|
|
1435
1561
|
* without a client
|
|
1436
1562
|
*
|
|
1437
|
-
* @param env - The environment to use
|
|
1438
1563
|
* @param inboxIds - The inbox IDs to get the state for
|
|
1564
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1439
1565
|
* @returns The inbox states for the specified inbox IDs
|
|
1440
1566
|
*/
|
|
1441
|
-
static fetchInboxStates(inboxIds: string[],
|
|
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>>;
|
|
1442
1609
|
/**
|
|
1443
1610
|
* Checks if the specified identifiers can be messaged
|
|
1444
1611
|
*
|
|
1445
1612
|
* @param identifiers - The identifiers to check
|
|
1446
1613
|
* @param env - Optional XMTP environment
|
|
1447
1614
|
* @returns Map of identifiers to whether they can be messaged
|
|
1615
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1616
|
+
* of `XmtpEnv`.
|
|
1448
1617
|
*/
|
|
1449
1618
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
1450
1619
|
/**
|
|
@@ -1461,8 +1630,20 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1461
1630
|
*
|
|
1462
1631
|
* @param inboxId - The inbox ID to check
|
|
1463
1632
|
* @param address - The address to check
|
|
1464
|
-
* @param
|
|
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
|
|
1465
1644
|
* @returns Whether the address is authorized
|
|
1645
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
1646
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
1466
1647
|
*/
|
|
1467
1648
|
static isAddressAuthorized(inboxId: string, address: string, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1468
1649
|
/**
|
|
@@ -1470,17 +1651,90 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1470
1651
|
*
|
|
1471
1652
|
* @param inboxId - The inbox ID to check
|
|
1472
1653
|
* @param installation - The installation to check
|
|
1473
|
-
* @param
|
|
1654
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
1474
1655
|
* @returns Whether the installation is authorized
|
|
1475
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
|
+
*/
|
|
1476
1669
|
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
|
|
1477
1670
|
/**
|
|
1478
1671
|
* Send a sync request to other devices on the network
|
|
1479
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)
|
|
1480
1675
|
* @returns Promise that resolves when the sync request is sent
|
|
1481
1676
|
*/
|
|
1482
|
-
sendSyncRequest(): Promise<void>;
|
|
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[];
|
|
1704
|
+
/**
|
|
1705
|
+
* Archive application elements to file for later restoration
|
|
1706
|
+
*
|
|
1707
|
+
* @param path - The file path to save the archive
|
|
1708
|
+
* @param key - Encryption key for the archive
|
|
1709
|
+
* @param opts - Archive options specifying what to include (defaults to consent and messages)
|
|
1710
|
+
* @returns Promise that resolves when the archive is created
|
|
1711
|
+
*/
|
|
1712
|
+
createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions): Promise<void>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Import a previous archive from a file
|
|
1715
|
+
*
|
|
1716
|
+
* @param path - The file path to the archive
|
|
1717
|
+
* @param key - Encryption key for the archive
|
|
1718
|
+
* @returns Promise that resolves when the archive is imported
|
|
1719
|
+
*/
|
|
1720
|
+
importArchive(path: string, key: Uint8Array): Promise<void>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Load the metadata for an archive to see what it contains
|
|
1723
|
+
*
|
|
1724
|
+
* Reads only the metadata without loading the entire file, so this function is quick.
|
|
1725
|
+
*
|
|
1726
|
+
* @param path - The file path to the archive
|
|
1727
|
+
* @param key - Encryption key for the archive
|
|
1728
|
+
* @returns Promise that resolves with the archive metadata
|
|
1729
|
+
*/
|
|
1730
|
+
archiveMetadata(path: string, key: Uint8Array): Promise<ArchiveMetadata>;
|
|
1731
|
+
/**
|
|
1732
|
+
* Manually sync all device sync groups
|
|
1733
|
+
*
|
|
1734
|
+
* @returns Promise that resolves with a summary of the sync operation
|
|
1735
|
+
*/
|
|
1736
|
+
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
|
|
1483
1737
|
}
|
|
1484
1738
|
|
|
1485
|
-
export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, HistorySyncUrls, InboxReassignError, MissingContentTypeError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createStream, generateInboxId, getInboxIdForIdentifier, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, validHex };
|
|
1486
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
|
|
1739
|
+
export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, HistorySyncUrls, InboxReassignError, MissingContentTypeError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createBackend, createStream, envToString, generateInboxId, getInboxIdForIdentifier, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, validHex };
|
|
1740
|
+
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
|