@xmtp/node-sdk 0.0.17
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/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/index.cjs +455 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +447 -0
- package/dist/index.js.map +1 -0
- package/package.json +94 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 XMTP (xmtp.org)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_path = require('node:path');
|
|
4
|
+
var process = require('node:process');
|
|
5
|
+
var contentTypeText = require('@xmtp/content-type-text');
|
|
6
|
+
var nodeBindings = require('@xmtp/node-bindings');
|
|
7
|
+
var contentTypePrimitives = require('@xmtp/content-type-primitives');
|
|
8
|
+
var proto = require('@xmtp/proto');
|
|
9
|
+
|
|
10
|
+
const ContentTypeGroupUpdated = new contentTypePrimitives.ContentTypeId({
|
|
11
|
+
authorityId: "xmtp.org",
|
|
12
|
+
typeId: "group_updated",
|
|
13
|
+
versionMajor: 1,
|
|
14
|
+
versionMinor: 0,
|
|
15
|
+
});
|
|
16
|
+
class GroupUpdatedCodec {
|
|
17
|
+
get contentType() {
|
|
18
|
+
return ContentTypeGroupUpdated;
|
|
19
|
+
}
|
|
20
|
+
encode(content) {
|
|
21
|
+
return {
|
|
22
|
+
type: this.contentType,
|
|
23
|
+
parameters: {},
|
|
24
|
+
content: proto.mlsTranscriptMessages.GroupUpdated.encode(content).finish(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
decode(content) {
|
|
28
|
+
return proto.mlsTranscriptMessages.GroupUpdated.decode(content.content);
|
|
29
|
+
}
|
|
30
|
+
fallback() {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
shouldPush() {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class AsyncStream {
|
|
39
|
+
#done = false;
|
|
40
|
+
#resolveNext;
|
|
41
|
+
#queue;
|
|
42
|
+
stopCallback = undefined;
|
|
43
|
+
constructor() {
|
|
44
|
+
this.#queue = [];
|
|
45
|
+
this.#resolveNext = null;
|
|
46
|
+
this.#done = false;
|
|
47
|
+
}
|
|
48
|
+
get isDone() {
|
|
49
|
+
return this.#done;
|
|
50
|
+
}
|
|
51
|
+
callback = (err, value) => {
|
|
52
|
+
if (err) {
|
|
53
|
+
console.error("stream error", err);
|
|
54
|
+
this.stop();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (this.#done) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (this.#resolveNext) {
|
|
61
|
+
this.#resolveNext({ value, done: false });
|
|
62
|
+
this.#resolveNext = null;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.#queue.push(value);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
stop = () => {
|
|
69
|
+
this.#done = true;
|
|
70
|
+
if (this.#resolveNext) {
|
|
71
|
+
this.#resolveNext({ value: undefined, done: true });
|
|
72
|
+
}
|
|
73
|
+
this.stopCallback?.();
|
|
74
|
+
};
|
|
75
|
+
next = () => {
|
|
76
|
+
if (this.#queue.length > 0) {
|
|
77
|
+
return Promise.resolve({ value: this.#queue.shift(), done: false });
|
|
78
|
+
}
|
|
79
|
+
else if (this.#done) {
|
|
80
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return new Promise((resolve) => {
|
|
84
|
+
this.#resolveNext = resolve;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
[Symbol.asyncIterator]() {
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function nsToDate(ns) {
|
|
94
|
+
return new Date(ns / 1_000_000);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
class DecodedMessage {
|
|
98
|
+
#client;
|
|
99
|
+
content;
|
|
100
|
+
contentType;
|
|
101
|
+
conversationId;
|
|
102
|
+
deliveryStatus;
|
|
103
|
+
fallback;
|
|
104
|
+
compression;
|
|
105
|
+
id;
|
|
106
|
+
kind;
|
|
107
|
+
parameters;
|
|
108
|
+
senderInboxId;
|
|
109
|
+
sentAt;
|
|
110
|
+
sentAtNs;
|
|
111
|
+
constructor(client, message) {
|
|
112
|
+
this.#client = client;
|
|
113
|
+
this.id = message.id;
|
|
114
|
+
this.sentAtNs = message.sentAtNs;
|
|
115
|
+
this.sentAt = nsToDate(message.sentAtNs);
|
|
116
|
+
this.conversationId = message.convoId;
|
|
117
|
+
this.senderInboxId = message.senderInboxId;
|
|
118
|
+
switch (message.kind) {
|
|
119
|
+
case 0 /* NapiGroupMessageKind.Application */:
|
|
120
|
+
this.kind = "application";
|
|
121
|
+
break;
|
|
122
|
+
case 1 /* NapiGroupMessageKind.MembershipChange */:
|
|
123
|
+
this.kind = "membership_change";
|
|
124
|
+
break;
|
|
125
|
+
// no default
|
|
126
|
+
}
|
|
127
|
+
switch (message.deliveryStatus) {
|
|
128
|
+
case 0 /* NapiDeliveryStatus.Unpublished */:
|
|
129
|
+
this.deliveryStatus = "unpublished";
|
|
130
|
+
break;
|
|
131
|
+
case 1 /* NapiDeliveryStatus.Published */:
|
|
132
|
+
this.deliveryStatus = "published";
|
|
133
|
+
break;
|
|
134
|
+
case 2 /* NapiDeliveryStatus.Failed */:
|
|
135
|
+
this.deliveryStatus = "failed";
|
|
136
|
+
break;
|
|
137
|
+
// no default
|
|
138
|
+
}
|
|
139
|
+
this.contentType = new contentTypePrimitives.ContentTypeId(message.content.type);
|
|
140
|
+
this.parameters = message.content.parameters;
|
|
141
|
+
this.fallback = message.content.fallback;
|
|
142
|
+
this.compression = message.content.compression;
|
|
143
|
+
this.content = this.#client.decodeContent(message, this.contentType);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
class Conversation {
|
|
148
|
+
#client;
|
|
149
|
+
#group;
|
|
150
|
+
constructor(client, group) {
|
|
151
|
+
this.#client = client;
|
|
152
|
+
this.#group = group;
|
|
153
|
+
}
|
|
154
|
+
get id() {
|
|
155
|
+
return this.#group.id();
|
|
156
|
+
}
|
|
157
|
+
get name() {
|
|
158
|
+
return this.#group.groupName();
|
|
159
|
+
}
|
|
160
|
+
async updateName(name) {
|
|
161
|
+
return this.#group.updateGroupName(name);
|
|
162
|
+
}
|
|
163
|
+
get imageUrl() {
|
|
164
|
+
return this.#group.groupImageUrlSquare();
|
|
165
|
+
}
|
|
166
|
+
async updateImageUrl(imageUrl) {
|
|
167
|
+
return this.#group.updateGroupImageUrlSquare(imageUrl);
|
|
168
|
+
}
|
|
169
|
+
get description() {
|
|
170
|
+
return this.#group.groupDescription();
|
|
171
|
+
}
|
|
172
|
+
async updateDescription(description) {
|
|
173
|
+
return this.#group.updateGroupDescription(description);
|
|
174
|
+
}
|
|
175
|
+
get pinnedFrameUrl() {
|
|
176
|
+
return this.#group.groupPinnedFrameUrl();
|
|
177
|
+
}
|
|
178
|
+
async updatePinnedFrameUrl(pinnedFrameUrl) {
|
|
179
|
+
return this.#group.updateGroupPinnedFrameUrl(pinnedFrameUrl);
|
|
180
|
+
}
|
|
181
|
+
get isActive() {
|
|
182
|
+
return this.#group.isActive();
|
|
183
|
+
}
|
|
184
|
+
get addedByInboxId() {
|
|
185
|
+
return this.#group.addedByInboxId();
|
|
186
|
+
}
|
|
187
|
+
get createdAtNs() {
|
|
188
|
+
return this.#group.createdAtNs();
|
|
189
|
+
}
|
|
190
|
+
get createdAt() {
|
|
191
|
+
return nsToDate(this.createdAtNs);
|
|
192
|
+
}
|
|
193
|
+
get metadata() {
|
|
194
|
+
const metadata = this.#group.groupMetadata();
|
|
195
|
+
return {
|
|
196
|
+
creatorInboxId: metadata.creatorInboxId(),
|
|
197
|
+
conversationType: metadata.conversationType(),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async members() {
|
|
201
|
+
return this.#group.listMembers();
|
|
202
|
+
}
|
|
203
|
+
get admins() {
|
|
204
|
+
return this.#group.adminList();
|
|
205
|
+
}
|
|
206
|
+
get superAdmins() {
|
|
207
|
+
return this.#group.superAdminList();
|
|
208
|
+
}
|
|
209
|
+
get permissions() {
|
|
210
|
+
return {
|
|
211
|
+
policyType: this.#group.groupPermissions().policyType(),
|
|
212
|
+
policySet: this.#group.groupPermissions().policySet(),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
isAdmin(inboxId) {
|
|
216
|
+
return this.#group.isAdmin(inboxId);
|
|
217
|
+
}
|
|
218
|
+
isSuperAdmin(inboxId) {
|
|
219
|
+
return this.#group.isSuperAdmin(inboxId);
|
|
220
|
+
}
|
|
221
|
+
async sync() {
|
|
222
|
+
return this.#group.sync();
|
|
223
|
+
}
|
|
224
|
+
stream(callback) {
|
|
225
|
+
const asyncStream = new AsyncStream();
|
|
226
|
+
const stream = this.#group.stream((err, message) => {
|
|
227
|
+
const decodedMessage = new DecodedMessage(this.#client, message);
|
|
228
|
+
asyncStream.callback(err, decodedMessage);
|
|
229
|
+
callback?.(err, decodedMessage);
|
|
230
|
+
});
|
|
231
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
232
|
+
return asyncStream;
|
|
233
|
+
}
|
|
234
|
+
async addMembers(accountAddresses) {
|
|
235
|
+
return this.#group.addMembers(accountAddresses);
|
|
236
|
+
}
|
|
237
|
+
async addMembersByInboxId(inboxIds) {
|
|
238
|
+
return this.#group.addMembersByInboxId(inboxIds);
|
|
239
|
+
}
|
|
240
|
+
async removeMembers(accountAddresses) {
|
|
241
|
+
return this.#group.removeMembers(accountAddresses);
|
|
242
|
+
}
|
|
243
|
+
async removeMembersByInboxId(inboxIds) {
|
|
244
|
+
return this.#group.removeMembersByInboxId(inboxIds);
|
|
245
|
+
}
|
|
246
|
+
async addAdmin(inboxId) {
|
|
247
|
+
return this.#group.addAdmin(inboxId);
|
|
248
|
+
}
|
|
249
|
+
async removeAdmin(inboxId) {
|
|
250
|
+
return this.#group.removeAdmin(inboxId);
|
|
251
|
+
}
|
|
252
|
+
async addSuperAdmin(inboxId) {
|
|
253
|
+
return this.#group.addSuperAdmin(inboxId);
|
|
254
|
+
}
|
|
255
|
+
async removeSuperAdmin(inboxId) {
|
|
256
|
+
return this.#group.removeSuperAdmin(inboxId);
|
|
257
|
+
}
|
|
258
|
+
async publishMessages() {
|
|
259
|
+
return this.#group.publishMessages();
|
|
260
|
+
}
|
|
261
|
+
sendOptimistic(content, contentType) {
|
|
262
|
+
if (typeof content !== "string" && !contentType) {
|
|
263
|
+
throw new Error("Content type is required when sending content other than text");
|
|
264
|
+
}
|
|
265
|
+
const encodedContent = typeof content === "string"
|
|
266
|
+
? this.#client.encodeContent(content, contentType ?? contentTypeText.ContentTypeText)
|
|
267
|
+
: this.#client.encodeContent(content, contentType);
|
|
268
|
+
return this.#group.sendOptimistic(encodedContent);
|
|
269
|
+
}
|
|
270
|
+
async send(content, contentType) {
|
|
271
|
+
if (typeof content !== "string" && !contentType) {
|
|
272
|
+
throw new Error("Content type is required when sending content other than text");
|
|
273
|
+
}
|
|
274
|
+
const encodedContent = typeof content === "string"
|
|
275
|
+
? this.#client.encodeContent(content, contentType ?? contentTypeText.ContentTypeText)
|
|
276
|
+
: this.#client.encodeContent(content, contentType);
|
|
277
|
+
return this.#group.send(encodedContent);
|
|
278
|
+
}
|
|
279
|
+
messages(options) {
|
|
280
|
+
return this.#group
|
|
281
|
+
.findMessages(options)
|
|
282
|
+
.map((message) => new DecodedMessage(this.#client, message));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
class Conversations {
|
|
287
|
+
#client;
|
|
288
|
+
#conversations;
|
|
289
|
+
constructor(client, conversations) {
|
|
290
|
+
this.#client = client;
|
|
291
|
+
this.#conversations = conversations;
|
|
292
|
+
}
|
|
293
|
+
getConversationById(id) {
|
|
294
|
+
try {
|
|
295
|
+
// findGroupById will throw if group is not found
|
|
296
|
+
const group = this.#conversations.findGroupById(id);
|
|
297
|
+
return new Conversation(this.#client, group);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
getMessageById(id) {
|
|
304
|
+
try {
|
|
305
|
+
// findMessageById will throw if message is not found
|
|
306
|
+
const message = this.#conversations.findMessageById(id);
|
|
307
|
+
return new DecodedMessage(this.#client, message);
|
|
308
|
+
}
|
|
309
|
+
catch {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
async newConversation(accountAddresses, options) {
|
|
314
|
+
const group = await this.#conversations.createGroup(accountAddresses, options);
|
|
315
|
+
const conversation = new Conversation(this.#client, group);
|
|
316
|
+
return conversation;
|
|
317
|
+
}
|
|
318
|
+
async list(options) {
|
|
319
|
+
const groups = await this.#conversations.list(options);
|
|
320
|
+
return groups.map((group) => {
|
|
321
|
+
const conversation = new Conversation(this.#client, group);
|
|
322
|
+
return conversation;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
async sync() {
|
|
326
|
+
return this.#conversations.sync();
|
|
327
|
+
}
|
|
328
|
+
stream(callback) {
|
|
329
|
+
const asyncStream = new AsyncStream();
|
|
330
|
+
const stream = this.#conversations.stream((err, group) => {
|
|
331
|
+
const conversation = new Conversation(this.#client, group);
|
|
332
|
+
asyncStream.callback(err, conversation);
|
|
333
|
+
callback?.(err, conversation);
|
|
334
|
+
});
|
|
335
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
336
|
+
return asyncStream;
|
|
337
|
+
}
|
|
338
|
+
async streamAllMessages(callback) {
|
|
339
|
+
// sync conversations first
|
|
340
|
+
await this.sync();
|
|
341
|
+
const asyncStream = new AsyncStream();
|
|
342
|
+
const stream = this.#conversations.streamAllMessages((err, message) => {
|
|
343
|
+
const decodedMessage = new DecodedMessage(this.#client, message);
|
|
344
|
+
asyncStream.callback(err, decodedMessage);
|
|
345
|
+
callback?.(err, decodedMessage);
|
|
346
|
+
});
|
|
347
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
348
|
+
return asyncStream;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const ApiUrls = {
|
|
353
|
+
local: "http://localhost:5556",
|
|
354
|
+
dev: "https://grpc.dev.xmtp.network:443",
|
|
355
|
+
production: "https://grpc.production.xmtp.network:443",
|
|
356
|
+
};
|
|
357
|
+
class Client {
|
|
358
|
+
#innerClient;
|
|
359
|
+
#conversations;
|
|
360
|
+
#codecs;
|
|
361
|
+
constructor(client, codecs) {
|
|
362
|
+
this.#innerClient = client;
|
|
363
|
+
this.#conversations = new Conversations(this, client.conversations());
|
|
364
|
+
this.#codecs = new Map(codecs.map((codec) => [codec.contentType.toString(), codec]));
|
|
365
|
+
}
|
|
366
|
+
static async create(accountAddress, options) {
|
|
367
|
+
const host = options?.apiUrl ?? ApiUrls[options?.env ?? "dev"];
|
|
368
|
+
const isSecure = host.startsWith("https");
|
|
369
|
+
const dbPath = options?.dbPath ?? node_path.join(process.cwd(), `${accountAddress}.db3`);
|
|
370
|
+
const inboxId = (await nodeBindings.getInboxIdForAddress(host, isSecure, accountAddress)) ||
|
|
371
|
+
nodeBindings.generateInboxId(accountAddress);
|
|
372
|
+
return new Client(await nodeBindings.createClient(host, isSecure, dbPath, inboxId, accountAddress, options?.encryptionKey, options?.requestHistorySync, options?.logging ?? "off"), [new GroupUpdatedCodec(), new contentTypeText.TextCodec(), ...(options?.codecs ?? [])]);
|
|
373
|
+
}
|
|
374
|
+
get accountAddress() {
|
|
375
|
+
return this.#innerClient.accountAddress;
|
|
376
|
+
}
|
|
377
|
+
get inboxId() {
|
|
378
|
+
return this.#innerClient.inboxId();
|
|
379
|
+
}
|
|
380
|
+
get installationId() {
|
|
381
|
+
return this.#innerClient.installationId();
|
|
382
|
+
}
|
|
383
|
+
get isRegistered() {
|
|
384
|
+
return this.#innerClient.isRegistered();
|
|
385
|
+
}
|
|
386
|
+
async signatureText() {
|
|
387
|
+
try {
|
|
388
|
+
const signatureText = await this.#innerClient.createInboxSignatureText();
|
|
389
|
+
return signatureText;
|
|
390
|
+
}
|
|
391
|
+
catch (e) {
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
async canMessage(accountAddresses) {
|
|
396
|
+
return this.#innerClient.canMessage(accountAddresses);
|
|
397
|
+
}
|
|
398
|
+
addSignature(signatureBytes) {
|
|
399
|
+
this.#innerClient.addSignature(1 /* NapiSignatureRequestType.CreateInbox */, signatureBytes);
|
|
400
|
+
}
|
|
401
|
+
async registerIdentity() {
|
|
402
|
+
return this.#innerClient.registerIdentity();
|
|
403
|
+
}
|
|
404
|
+
get conversations() {
|
|
405
|
+
return this.#conversations;
|
|
406
|
+
}
|
|
407
|
+
codecFor(contentType) {
|
|
408
|
+
return this.#codecs.get(contentType.toString());
|
|
409
|
+
}
|
|
410
|
+
encodeContent(content, contentType) {
|
|
411
|
+
const codec = this.codecFor(contentType);
|
|
412
|
+
if (!codec) {
|
|
413
|
+
throw new Error(`no codec for ${contentType.toString()}`);
|
|
414
|
+
}
|
|
415
|
+
const encoded = codec.encode(content, this);
|
|
416
|
+
const fallback = codec.fallback(content);
|
|
417
|
+
if (fallback) {
|
|
418
|
+
encoded.fallback = fallback;
|
|
419
|
+
}
|
|
420
|
+
return encoded;
|
|
421
|
+
}
|
|
422
|
+
decodeContent(message, contentType) {
|
|
423
|
+
const codec = this.codecFor(contentType);
|
|
424
|
+
if (!codec) {
|
|
425
|
+
throw new Error(`no codec for ${contentType.toString()}`);
|
|
426
|
+
}
|
|
427
|
+
// throw an error if there's an invalid group membership change message
|
|
428
|
+
if (contentType.sameAs(ContentTypeGroupUpdated) &&
|
|
429
|
+
message.kind !== 1 /* NapiGroupMessageKind.MembershipChange */) {
|
|
430
|
+
throw new Error("Error decoding group membership change");
|
|
431
|
+
}
|
|
432
|
+
return codec.decode(message.content, this);
|
|
433
|
+
}
|
|
434
|
+
async requestHistorySync() {
|
|
435
|
+
return this.#innerClient.requestHistorySync();
|
|
436
|
+
}
|
|
437
|
+
async getInboxIdByAddress(accountAddress) {
|
|
438
|
+
return this.#innerClient.findInboxIdByAddress(accountAddress);
|
|
439
|
+
}
|
|
440
|
+
async inboxState(refreshFromNetwork = false) {
|
|
441
|
+
return this.#innerClient.inboxState(refreshFromNetwork);
|
|
442
|
+
}
|
|
443
|
+
async inboxStateFromInboxIds(inboxIds, refreshFromNetwork) {
|
|
444
|
+
return this.#innerClient.addressesFromInboxId(refreshFromNetwork ?? false, inboxIds);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
exports.ApiUrls = ApiUrls;
|
|
449
|
+
exports.Client = Client;
|
|
450
|
+
exports.ContentTypeGroupUpdated = ContentTypeGroupUpdated;
|
|
451
|
+
exports.Conversation = Conversation;
|
|
452
|
+
exports.Conversations = Conversations;
|
|
453
|
+
exports.DecodedMessage = DecodedMessage;
|
|
454
|
+
exports.GroupUpdatedCodec = GroupUpdatedCodec;
|
|
455
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/codecs/GroupUpdatedCodec.ts","../src/AsyncStream.ts","../src/helpers/date.ts","../src/DecodedMessage.ts","../src/Conversation.ts","../src/Conversations.ts","../src/Client.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["ContentTypeId","mlsTranscriptMessages","ContentTypeText","join","getInboxIdForAddress","generateInboxId","createClient","TextCodec"],"mappings":";;;;;;;;;AAOa,MAAA,uBAAuB,GAAG,IAAIA,mCAAa,CAAC;AACvD,IAAA,WAAW,EAAE,UAAU;AACvB,IAAA,MAAM,EAAE,eAAe;AACvB,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,YAAY,EAAE,CAAC;AAChB,CAAA,EAAE;MAEU,iBAAiB,CAAA;AAG5B,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,uBAAuB,CAAC;KAChC;AAED,IAAA,MAAM,CAAC,OAA2C,EAAA;QAChD,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW;AACtB,YAAA,UAAU,EAAE,EAAE;YACd,OAAO,EAAEC,2BAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;SACrE,CAAC;KACH;AAED,IAAA,MAAM,CAAC,OAAuB,EAAA;QAC5B,OAAOA,2B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,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,CAAgB,aAAA,EAAA,WAAW,CAAC,QAAQ,EAAE,CAAE,CAAA,CAAC,CAAC;SAC3D;;AAGD,QAAA,IACE,WAAW,CAAC,MAAM,CAAC,uBAAuB,CAAC;AAC3C,YAAA,OAAO,CAAC,IAAI,KAA0C,CAAA,8CACtD;AACA,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAyB,EAAE,IAAI,CAAC,CAAC;KAC9D;AAED,IAAA,MAAM,kBAAkB,GAAA;AACtB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;KAC/C;IAED,MAAM,mBAAmB,CAAC,cAAsB,EAAA;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;KAC/D;AAED,IAAA,MAAM,UAAU,CAAC,kBAAA,GAA8B,KAAK,EAAA;QAClD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;KACzD;AAED,IAAA,MAAM,sBAAsB,CAC1B,QAAkB,EAClB,kBAA4B,EAAA;AAE5B,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAC3C,kBAAkB,IAAI,KAAK,EAC3B,QAAQ,CACT,CAAC;KACH;AACF;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as _xmtp_node_bindings from '@xmtp/node-bindings';
|
|
2
|
+
import { NapiMessage, NapiGroup, NapiListMessagesOptions, NapiConversations, NapiCreateGroupOptions, NapiClient } from '@xmtp/node-bindings';
|
|
3
|
+
export * from '@xmtp/node-bindings';
|
|
4
|
+
import { ContentTypeId, ContentCodec, EncodedContent } from '@xmtp/content-type-primitives';
|
|
5
|
+
import { mlsTranscriptMessages } from '@xmtp/proto';
|
|
6
|
+
|
|
7
|
+
type ResolveValue<T> = {
|
|
8
|
+
value: T | undefined;
|
|
9
|
+
done: boolean;
|
|
10
|
+
};
|
|
11
|
+
type StreamCallback<T> = (err: Error | null, value: T) => void;
|
|
12
|
+
declare class AsyncStream<T> {
|
|
13
|
+
#private;
|
|
14
|
+
stopCallback: (() => void) | undefined;
|
|
15
|
+
constructor();
|
|
16
|
+
get isDone(): boolean;
|
|
17
|
+
callback: StreamCallback<T>;
|
|
18
|
+
stop: () => void;
|
|
19
|
+
next: () => Promise<ResolveValue<T>>;
|
|
20
|
+
[Symbol.asyncIterator](): this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type MessageKind = "application" | "membership_change";
|
|
24
|
+
type MessageDeliveryStatus = "unpublished" | "published" | "failed";
|
|
25
|
+
declare class DecodedMessage {
|
|
26
|
+
#private;
|
|
27
|
+
content: any;
|
|
28
|
+
contentType: ContentTypeId;
|
|
29
|
+
conversationId: string;
|
|
30
|
+
deliveryStatus: MessageDeliveryStatus;
|
|
31
|
+
fallback?: string;
|
|
32
|
+
compression?: number;
|
|
33
|
+
id: string;
|
|
34
|
+
kind: MessageKind;
|
|
35
|
+
parameters: Record<string, string>;
|
|
36
|
+
senderInboxId: string;
|
|
37
|
+
sentAt: Date;
|
|
38
|
+
sentAtNs: number;
|
|
39
|
+
constructor(client: Client, message: NapiMessage);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare class Conversation {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(client: Client, group: NapiGroup);
|
|
45
|
+
get id(): string;
|
|
46
|
+
get name(): string;
|
|
47
|
+
updateName(name: string): Promise<void>;
|
|
48
|
+
get imageUrl(): string;
|
|
49
|
+
updateImageUrl(imageUrl: string): Promise<void>;
|
|
50
|
+
get description(): string;
|
|
51
|
+
updateDescription(description: string): Promise<void>;
|
|
52
|
+
get pinnedFrameUrl(): string;
|
|
53
|
+
updatePinnedFrameUrl(pinnedFrameUrl: string): Promise<void>;
|
|
54
|
+
get isActive(): boolean;
|
|
55
|
+
get addedByInboxId(): string;
|
|
56
|
+
get createdAtNs(): number;
|
|
57
|
+
get createdAt(): Date;
|
|
58
|
+
get metadata(): {
|
|
59
|
+
creatorInboxId: string;
|
|
60
|
+
conversationType: string;
|
|
61
|
+
};
|
|
62
|
+
members(): Promise<_xmtp_node_bindings.NapiGroupMember[]>;
|
|
63
|
+
get admins(): string[];
|
|
64
|
+
get superAdmins(): string[];
|
|
65
|
+
get permissions(): {
|
|
66
|
+
policyType: _xmtp_node_bindings.NapiGroupPermissionsOptions;
|
|
67
|
+
policySet: _xmtp_node_bindings.NapiPermissionPolicySet;
|
|
68
|
+
};
|
|
69
|
+
isAdmin(inboxId: string): boolean;
|
|
70
|
+
isSuperAdmin(inboxId: string): boolean;
|
|
71
|
+
sync(): Promise<void>;
|
|
72
|
+
stream(callback?: StreamCallback<DecodedMessage>): AsyncStream<DecodedMessage>;
|
|
73
|
+
addMembers(accountAddresses: string[]): Promise<void>;
|
|
74
|
+
addMembersByInboxId(inboxIds: string[]): Promise<void>;
|
|
75
|
+
removeMembers(accountAddresses: string[]): Promise<void>;
|
|
76
|
+
removeMembersByInboxId(inboxIds: string[]): Promise<void>;
|
|
77
|
+
addAdmin(inboxId: string): Promise<void>;
|
|
78
|
+
removeAdmin(inboxId: string): Promise<void>;
|
|
79
|
+
addSuperAdmin(inboxId: string): Promise<void>;
|
|
80
|
+
removeSuperAdmin(inboxId: string): Promise<void>;
|
|
81
|
+
publishMessages(): Promise<void>;
|
|
82
|
+
sendOptimistic(content: any, contentType?: ContentTypeId): string;
|
|
83
|
+
send(content: any, contentType?: ContentTypeId): Promise<string>;
|
|
84
|
+
messages(options?: NapiListMessagesOptions): DecodedMessage[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare class Conversations {
|
|
88
|
+
#private;
|
|
89
|
+
constructor(client: Client, conversations: NapiConversations);
|
|
90
|
+
getConversationById(id: string): Conversation | null;
|
|
91
|
+
getMessageById(id: string): DecodedMessage | null;
|
|
92
|
+
newConversation(accountAddresses: string[], options?: NapiCreateGroupOptions): Promise<Conversation>;
|
|
93
|
+
list(options?: NapiListMessagesOptions): Promise<Conversation[]>;
|
|
94
|
+
sync(): Promise<void>;
|
|
95
|
+
stream(callback?: StreamCallback<Conversation>): AsyncStream<Conversation>;
|
|
96
|
+
streamAllMessages(callback?: StreamCallback<DecodedMessage>): Promise<AsyncStream<DecodedMessage>>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare const ApiUrls: {
|
|
100
|
+
readonly local: "http://localhost:5556";
|
|
101
|
+
readonly dev: "https://grpc.dev.xmtp.network:443";
|
|
102
|
+
readonly production: "https://grpc.production.xmtp.network:443";
|
|
103
|
+
};
|
|
104
|
+
type XmtpEnv = keyof typeof ApiUrls;
|
|
105
|
+
/**
|
|
106
|
+
* Network options
|
|
107
|
+
*/
|
|
108
|
+
type NetworkOptions = {
|
|
109
|
+
/**
|
|
110
|
+
* Specify which XMTP environment to connect to. (default: `dev`)
|
|
111
|
+
*/
|
|
112
|
+
env?: XmtpEnv;
|
|
113
|
+
/**
|
|
114
|
+
* apiUrl can be used to override the `env` flag and connect to a
|
|
115
|
+
* specific endpoint
|
|
116
|
+
*/
|
|
117
|
+
apiUrl?: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Storage options
|
|
121
|
+
*/
|
|
122
|
+
type StorageOptions = {
|
|
123
|
+
/**
|
|
124
|
+
* Encryption key to use for the local DB
|
|
125
|
+
*/
|
|
126
|
+
encryptionKey?: Uint8Array | null;
|
|
127
|
+
/**
|
|
128
|
+
* Path to the local DB
|
|
129
|
+
*/
|
|
130
|
+
dbPath?: string;
|
|
131
|
+
};
|
|
132
|
+
type ContentOptions = {
|
|
133
|
+
/**
|
|
134
|
+
* Allow configuring codecs for additional content types
|
|
135
|
+
*/
|
|
136
|
+
codecs?: ContentCodec<any>[];
|
|
137
|
+
};
|
|
138
|
+
type OtherOptions = {
|
|
139
|
+
/**
|
|
140
|
+
* Optionally set the request history sync URL
|
|
141
|
+
*/
|
|
142
|
+
requestHistorySync?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Optionally set the logging level (default: 'off')
|
|
145
|
+
*/
|
|
146
|
+
logging?: "debug" | "info" | "warn" | "error" | "off";
|
|
147
|
+
};
|
|
148
|
+
type ClientOptions = NetworkOptions & StorageOptions & ContentOptions & OtherOptions;
|
|
149
|
+
declare class Client {
|
|
150
|
+
#private;
|
|
151
|
+
constructor(client: NapiClient, codecs: ContentCodec<any>[]);
|
|
152
|
+
static create(accountAddress: string, options?: ClientOptions): Promise<Client>;
|
|
153
|
+
get accountAddress(): string;
|
|
154
|
+
get inboxId(): string;
|
|
155
|
+
get installationId(): string;
|
|
156
|
+
get isRegistered(): boolean;
|
|
157
|
+
signatureText(): Promise<string | null>;
|
|
158
|
+
canMessage(accountAddresses: string[]): Promise<Record<string, boolean>>;
|
|
159
|
+
addSignature(signatureBytes: Uint8Array): void;
|
|
160
|
+
registerIdentity(): Promise<void>;
|
|
161
|
+
get conversations(): Conversations;
|
|
162
|
+
codecFor(contentType: ContentTypeId): ContentCodec<any> | undefined;
|
|
163
|
+
encodeContent(content: any, contentType: ContentTypeId): EncodedContent<Record<string, string>>;
|
|
164
|
+
decodeContent(message: NapiMessage, contentType: ContentTypeId): any;
|
|
165
|
+
requestHistorySync(): Promise<void>;
|
|
166
|
+
getInboxIdByAddress(accountAddress: string): Promise<string | null>;
|
|
167
|
+
inboxState(refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.NapiInboxState>;
|
|
168
|
+
inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.NapiInboxState[]>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const ContentTypeGroupUpdated: ContentTypeId;
|
|
172
|
+
declare class GroupUpdatedCodec implements ContentCodec<mlsTranscriptMessages.GroupUpdated> {
|
|
173
|
+
get contentType(): ContentTypeId;
|
|
174
|
+
encode(content: mlsTranscriptMessages.GroupUpdated): EncodedContent;
|
|
175
|
+
decode(content: EncodedContent): mlsTranscriptMessages.GroupUpdated;
|
|
176
|
+
fallback(): undefined;
|
|
177
|
+
shouldPush(): boolean;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { ApiUrls, Client, type ClientOptions, ContentTypeGroupUpdated, Conversation, Conversations, DecodedMessage, GroupUpdatedCodec, type NetworkOptions, type OtherOptions, type StorageOptions, type StreamCallback, type XmtpEnv };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { ContentTypeText, TextCodec } from '@xmtp/content-type-text';
|
|
4
|
+
import { getInboxIdForAddress, generateInboxId, createClient } from '@xmtp/node-bindings';
|
|
5
|
+
import { ContentTypeId } from '@xmtp/content-type-primitives';
|
|
6
|
+
import { mlsTranscriptMessages } from '@xmtp/proto';
|
|
7
|
+
|
|
8
|
+
const ContentTypeGroupUpdated = new ContentTypeId({
|
|
9
|
+
authorityId: "xmtp.org",
|
|
10
|
+
typeId: "group_updated",
|
|
11
|
+
versionMajor: 1,
|
|
12
|
+
versionMinor: 0,
|
|
13
|
+
});
|
|
14
|
+
class GroupUpdatedCodec {
|
|
15
|
+
get contentType() {
|
|
16
|
+
return ContentTypeGroupUpdated;
|
|
17
|
+
}
|
|
18
|
+
encode(content) {
|
|
19
|
+
return {
|
|
20
|
+
type: this.contentType,
|
|
21
|
+
parameters: {},
|
|
22
|
+
content: mlsTranscriptMessages.GroupUpdated.encode(content).finish(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
decode(content) {
|
|
26
|
+
return mlsTranscriptMessages.GroupUpdated.decode(content.content);
|
|
27
|
+
}
|
|
28
|
+
fallback() {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
shouldPush() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class AsyncStream {
|
|
37
|
+
#done = false;
|
|
38
|
+
#resolveNext;
|
|
39
|
+
#queue;
|
|
40
|
+
stopCallback = undefined;
|
|
41
|
+
constructor() {
|
|
42
|
+
this.#queue = [];
|
|
43
|
+
this.#resolveNext = null;
|
|
44
|
+
this.#done = false;
|
|
45
|
+
}
|
|
46
|
+
get isDone() {
|
|
47
|
+
return this.#done;
|
|
48
|
+
}
|
|
49
|
+
callback = (err, value) => {
|
|
50
|
+
if (err) {
|
|
51
|
+
console.error("stream error", err);
|
|
52
|
+
this.stop();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (this.#done) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (this.#resolveNext) {
|
|
59
|
+
this.#resolveNext({ value, done: false });
|
|
60
|
+
this.#resolveNext = null;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.#queue.push(value);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
stop = () => {
|
|
67
|
+
this.#done = true;
|
|
68
|
+
if (this.#resolveNext) {
|
|
69
|
+
this.#resolveNext({ value: undefined, done: true });
|
|
70
|
+
}
|
|
71
|
+
this.stopCallback?.();
|
|
72
|
+
};
|
|
73
|
+
next = () => {
|
|
74
|
+
if (this.#queue.length > 0) {
|
|
75
|
+
return Promise.resolve({ value: this.#queue.shift(), done: false });
|
|
76
|
+
}
|
|
77
|
+
else if (this.#done) {
|
|
78
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return new Promise((resolve) => {
|
|
82
|
+
this.#resolveNext = resolve;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
[Symbol.asyncIterator]() {
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function nsToDate(ns) {
|
|
92
|
+
return new Date(ns / 1_000_000);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
class DecodedMessage {
|
|
96
|
+
#client;
|
|
97
|
+
content;
|
|
98
|
+
contentType;
|
|
99
|
+
conversationId;
|
|
100
|
+
deliveryStatus;
|
|
101
|
+
fallback;
|
|
102
|
+
compression;
|
|
103
|
+
id;
|
|
104
|
+
kind;
|
|
105
|
+
parameters;
|
|
106
|
+
senderInboxId;
|
|
107
|
+
sentAt;
|
|
108
|
+
sentAtNs;
|
|
109
|
+
constructor(client, message) {
|
|
110
|
+
this.#client = client;
|
|
111
|
+
this.id = message.id;
|
|
112
|
+
this.sentAtNs = message.sentAtNs;
|
|
113
|
+
this.sentAt = nsToDate(message.sentAtNs);
|
|
114
|
+
this.conversationId = message.convoId;
|
|
115
|
+
this.senderInboxId = message.senderInboxId;
|
|
116
|
+
switch (message.kind) {
|
|
117
|
+
case 0 /* NapiGroupMessageKind.Application */:
|
|
118
|
+
this.kind = "application";
|
|
119
|
+
break;
|
|
120
|
+
case 1 /* NapiGroupMessageKind.MembershipChange */:
|
|
121
|
+
this.kind = "membership_change";
|
|
122
|
+
break;
|
|
123
|
+
// no default
|
|
124
|
+
}
|
|
125
|
+
switch (message.deliveryStatus) {
|
|
126
|
+
case 0 /* NapiDeliveryStatus.Unpublished */:
|
|
127
|
+
this.deliveryStatus = "unpublished";
|
|
128
|
+
break;
|
|
129
|
+
case 1 /* NapiDeliveryStatus.Published */:
|
|
130
|
+
this.deliveryStatus = "published";
|
|
131
|
+
break;
|
|
132
|
+
case 2 /* NapiDeliveryStatus.Failed */:
|
|
133
|
+
this.deliveryStatus = "failed";
|
|
134
|
+
break;
|
|
135
|
+
// no default
|
|
136
|
+
}
|
|
137
|
+
this.contentType = new ContentTypeId(message.content.type);
|
|
138
|
+
this.parameters = message.content.parameters;
|
|
139
|
+
this.fallback = message.content.fallback;
|
|
140
|
+
this.compression = message.content.compression;
|
|
141
|
+
this.content = this.#client.decodeContent(message, this.contentType);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
class Conversation {
|
|
146
|
+
#client;
|
|
147
|
+
#group;
|
|
148
|
+
constructor(client, group) {
|
|
149
|
+
this.#client = client;
|
|
150
|
+
this.#group = group;
|
|
151
|
+
}
|
|
152
|
+
get id() {
|
|
153
|
+
return this.#group.id();
|
|
154
|
+
}
|
|
155
|
+
get name() {
|
|
156
|
+
return this.#group.groupName();
|
|
157
|
+
}
|
|
158
|
+
async updateName(name) {
|
|
159
|
+
return this.#group.updateGroupName(name);
|
|
160
|
+
}
|
|
161
|
+
get imageUrl() {
|
|
162
|
+
return this.#group.groupImageUrlSquare();
|
|
163
|
+
}
|
|
164
|
+
async updateImageUrl(imageUrl) {
|
|
165
|
+
return this.#group.updateGroupImageUrlSquare(imageUrl);
|
|
166
|
+
}
|
|
167
|
+
get description() {
|
|
168
|
+
return this.#group.groupDescription();
|
|
169
|
+
}
|
|
170
|
+
async updateDescription(description) {
|
|
171
|
+
return this.#group.updateGroupDescription(description);
|
|
172
|
+
}
|
|
173
|
+
get pinnedFrameUrl() {
|
|
174
|
+
return this.#group.groupPinnedFrameUrl();
|
|
175
|
+
}
|
|
176
|
+
async updatePinnedFrameUrl(pinnedFrameUrl) {
|
|
177
|
+
return this.#group.updateGroupPinnedFrameUrl(pinnedFrameUrl);
|
|
178
|
+
}
|
|
179
|
+
get isActive() {
|
|
180
|
+
return this.#group.isActive();
|
|
181
|
+
}
|
|
182
|
+
get addedByInboxId() {
|
|
183
|
+
return this.#group.addedByInboxId();
|
|
184
|
+
}
|
|
185
|
+
get createdAtNs() {
|
|
186
|
+
return this.#group.createdAtNs();
|
|
187
|
+
}
|
|
188
|
+
get createdAt() {
|
|
189
|
+
return nsToDate(this.createdAtNs);
|
|
190
|
+
}
|
|
191
|
+
get metadata() {
|
|
192
|
+
const metadata = this.#group.groupMetadata();
|
|
193
|
+
return {
|
|
194
|
+
creatorInboxId: metadata.creatorInboxId(),
|
|
195
|
+
conversationType: metadata.conversationType(),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async members() {
|
|
199
|
+
return this.#group.listMembers();
|
|
200
|
+
}
|
|
201
|
+
get admins() {
|
|
202
|
+
return this.#group.adminList();
|
|
203
|
+
}
|
|
204
|
+
get superAdmins() {
|
|
205
|
+
return this.#group.superAdminList();
|
|
206
|
+
}
|
|
207
|
+
get permissions() {
|
|
208
|
+
return {
|
|
209
|
+
policyType: this.#group.groupPermissions().policyType(),
|
|
210
|
+
policySet: this.#group.groupPermissions().policySet(),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
isAdmin(inboxId) {
|
|
214
|
+
return this.#group.isAdmin(inboxId);
|
|
215
|
+
}
|
|
216
|
+
isSuperAdmin(inboxId) {
|
|
217
|
+
return this.#group.isSuperAdmin(inboxId);
|
|
218
|
+
}
|
|
219
|
+
async sync() {
|
|
220
|
+
return this.#group.sync();
|
|
221
|
+
}
|
|
222
|
+
stream(callback) {
|
|
223
|
+
const asyncStream = new AsyncStream();
|
|
224
|
+
const stream = this.#group.stream((err, message) => {
|
|
225
|
+
const decodedMessage = new DecodedMessage(this.#client, message);
|
|
226
|
+
asyncStream.callback(err, decodedMessage);
|
|
227
|
+
callback?.(err, decodedMessage);
|
|
228
|
+
});
|
|
229
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
230
|
+
return asyncStream;
|
|
231
|
+
}
|
|
232
|
+
async addMembers(accountAddresses) {
|
|
233
|
+
return this.#group.addMembers(accountAddresses);
|
|
234
|
+
}
|
|
235
|
+
async addMembersByInboxId(inboxIds) {
|
|
236
|
+
return this.#group.addMembersByInboxId(inboxIds);
|
|
237
|
+
}
|
|
238
|
+
async removeMembers(accountAddresses) {
|
|
239
|
+
return this.#group.removeMembers(accountAddresses);
|
|
240
|
+
}
|
|
241
|
+
async removeMembersByInboxId(inboxIds) {
|
|
242
|
+
return this.#group.removeMembersByInboxId(inboxIds);
|
|
243
|
+
}
|
|
244
|
+
async addAdmin(inboxId) {
|
|
245
|
+
return this.#group.addAdmin(inboxId);
|
|
246
|
+
}
|
|
247
|
+
async removeAdmin(inboxId) {
|
|
248
|
+
return this.#group.removeAdmin(inboxId);
|
|
249
|
+
}
|
|
250
|
+
async addSuperAdmin(inboxId) {
|
|
251
|
+
return this.#group.addSuperAdmin(inboxId);
|
|
252
|
+
}
|
|
253
|
+
async removeSuperAdmin(inboxId) {
|
|
254
|
+
return this.#group.removeSuperAdmin(inboxId);
|
|
255
|
+
}
|
|
256
|
+
async publishMessages() {
|
|
257
|
+
return this.#group.publishMessages();
|
|
258
|
+
}
|
|
259
|
+
sendOptimistic(content, contentType) {
|
|
260
|
+
if (typeof content !== "string" && !contentType) {
|
|
261
|
+
throw new Error("Content type is required when sending content other than text");
|
|
262
|
+
}
|
|
263
|
+
const encodedContent = typeof content === "string"
|
|
264
|
+
? this.#client.encodeContent(content, contentType ?? ContentTypeText)
|
|
265
|
+
: this.#client.encodeContent(content, contentType);
|
|
266
|
+
return this.#group.sendOptimistic(encodedContent);
|
|
267
|
+
}
|
|
268
|
+
async send(content, contentType) {
|
|
269
|
+
if (typeof content !== "string" && !contentType) {
|
|
270
|
+
throw new Error("Content type is required when sending content other than text");
|
|
271
|
+
}
|
|
272
|
+
const encodedContent = typeof content === "string"
|
|
273
|
+
? this.#client.encodeContent(content, contentType ?? ContentTypeText)
|
|
274
|
+
: this.#client.encodeContent(content, contentType);
|
|
275
|
+
return this.#group.send(encodedContent);
|
|
276
|
+
}
|
|
277
|
+
messages(options) {
|
|
278
|
+
return this.#group
|
|
279
|
+
.findMessages(options)
|
|
280
|
+
.map((message) => new DecodedMessage(this.#client, message));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
class Conversations {
|
|
285
|
+
#client;
|
|
286
|
+
#conversations;
|
|
287
|
+
constructor(client, conversations) {
|
|
288
|
+
this.#client = client;
|
|
289
|
+
this.#conversations = conversations;
|
|
290
|
+
}
|
|
291
|
+
getConversationById(id) {
|
|
292
|
+
try {
|
|
293
|
+
// findGroupById will throw if group is not found
|
|
294
|
+
const group = this.#conversations.findGroupById(id);
|
|
295
|
+
return new Conversation(this.#client, group);
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
getMessageById(id) {
|
|
302
|
+
try {
|
|
303
|
+
// findMessageById will throw if message is not found
|
|
304
|
+
const message = this.#conversations.findMessageById(id);
|
|
305
|
+
return new DecodedMessage(this.#client, message);
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async newConversation(accountAddresses, options) {
|
|
312
|
+
const group = await this.#conversations.createGroup(accountAddresses, options);
|
|
313
|
+
const conversation = new Conversation(this.#client, group);
|
|
314
|
+
return conversation;
|
|
315
|
+
}
|
|
316
|
+
async list(options) {
|
|
317
|
+
const groups = await this.#conversations.list(options);
|
|
318
|
+
return groups.map((group) => {
|
|
319
|
+
const conversation = new Conversation(this.#client, group);
|
|
320
|
+
return conversation;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async sync() {
|
|
324
|
+
return this.#conversations.sync();
|
|
325
|
+
}
|
|
326
|
+
stream(callback) {
|
|
327
|
+
const asyncStream = new AsyncStream();
|
|
328
|
+
const stream = this.#conversations.stream((err, group) => {
|
|
329
|
+
const conversation = new Conversation(this.#client, group);
|
|
330
|
+
asyncStream.callback(err, conversation);
|
|
331
|
+
callback?.(err, conversation);
|
|
332
|
+
});
|
|
333
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
334
|
+
return asyncStream;
|
|
335
|
+
}
|
|
336
|
+
async streamAllMessages(callback) {
|
|
337
|
+
// sync conversations first
|
|
338
|
+
await this.sync();
|
|
339
|
+
const asyncStream = new AsyncStream();
|
|
340
|
+
const stream = this.#conversations.streamAllMessages((err, message) => {
|
|
341
|
+
const decodedMessage = new DecodedMessage(this.#client, message);
|
|
342
|
+
asyncStream.callback(err, decodedMessage);
|
|
343
|
+
callback?.(err, decodedMessage);
|
|
344
|
+
});
|
|
345
|
+
asyncStream.stopCallback = stream.end.bind(stream);
|
|
346
|
+
return asyncStream;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const ApiUrls = {
|
|
351
|
+
local: "http://localhost:5556",
|
|
352
|
+
dev: "https://grpc.dev.xmtp.network:443",
|
|
353
|
+
production: "https://grpc.production.xmtp.network:443",
|
|
354
|
+
};
|
|
355
|
+
class Client {
|
|
356
|
+
#innerClient;
|
|
357
|
+
#conversations;
|
|
358
|
+
#codecs;
|
|
359
|
+
constructor(client, codecs) {
|
|
360
|
+
this.#innerClient = client;
|
|
361
|
+
this.#conversations = new Conversations(this, client.conversations());
|
|
362
|
+
this.#codecs = new Map(codecs.map((codec) => [codec.contentType.toString(), codec]));
|
|
363
|
+
}
|
|
364
|
+
static async create(accountAddress, options) {
|
|
365
|
+
const host = options?.apiUrl ?? ApiUrls[options?.env ?? "dev"];
|
|
366
|
+
const isSecure = host.startsWith("https");
|
|
367
|
+
const dbPath = options?.dbPath ?? join(process.cwd(), `${accountAddress}.db3`);
|
|
368
|
+
const inboxId = (await getInboxIdForAddress(host, isSecure, accountAddress)) ||
|
|
369
|
+
generateInboxId(accountAddress);
|
|
370
|
+
return new Client(await createClient(host, isSecure, dbPath, inboxId, accountAddress, options?.encryptionKey, options?.requestHistorySync, options?.logging ?? "off"), [new GroupUpdatedCodec(), new TextCodec(), ...(options?.codecs ?? [])]);
|
|
371
|
+
}
|
|
372
|
+
get accountAddress() {
|
|
373
|
+
return this.#innerClient.accountAddress;
|
|
374
|
+
}
|
|
375
|
+
get inboxId() {
|
|
376
|
+
return this.#innerClient.inboxId();
|
|
377
|
+
}
|
|
378
|
+
get installationId() {
|
|
379
|
+
return this.#innerClient.installationId();
|
|
380
|
+
}
|
|
381
|
+
get isRegistered() {
|
|
382
|
+
return this.#innerClient.isRegistered();
|
|
383
|
+
}
|
|
384
|
+
async signatureText() {
|
|
385
|
+
try {
|
|
386
|
+
const signatureText = await this.#innerClient.createInboxSignatureText();
|
|
387
|
+
return signatureText;
|
|
388
|
+
}
|
|
389
|
+
catch (e) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
async canMessage(accountAddresses) {
|
|
394
|
+
return this.#innerClient.canMessage(accountAddresses);
|
|
395
|
+
}
|
|
396
|
+
addSignature(signatureBytes) {
|
|
397
|
+
this.#innerClient.addSignature(1 /* NapiSignatureRequestType.CreateInbox */, signatureBytes);
|
|
398
|
+
}
|
|
399
|
+
async registerIdentity() {
|
|
400
|
+
return this.#innerClient.registerIdentity();
|
|
401
|
+
}
|
|
402
|
+
get conversations() {
|
|
403
|
+
return this.#conversations;
|
|
404
|
+
}
|
|
405
|
+
codecFor(contentType) {
|
|
406
|
+
return this.#codecs.get(contentType.toString());
|
|
407
|
+
}
|
|
408
|
+
encodeContent(content, contentType) {
|
|
409
|
+
const codec = this.codecFor(contentType);
|
|
410
|
+
if (!codec) {
|
|
411
|
+
throw new Error(`no codec for ${contentType.toString()}`);
|
|
412
|
+
}
|
|
413
|
+
const encoded = codec.encode(content, this);
|
|
414
|
+
const fallback = codec.fallback(content);
|
|
415
|
+
if (fallback) {
|
|
416
|
+
encoded.fallback = fallback;
|
|
417
|
+
}
|
|
418
|
+
return encoded;
|
|
419
|
+
}
|
|
420
|
+
decodeContent(message, contentType) {
|
|
421
|
+
const codec = this.codecFor(contentType);
|
|
422
|
+
if (!codec) {
|
|
423
|
+
throw new Error(`no codec for ${contentType.toString()}`);
|
|
424
|
+
}
|
|
425
|
+
// throw an error if there's an invalid group membership change message
|
|
426
|
+
if (contentType.sameAs(ContentTypeGroupUpdated) &&
|
|
427
|
+
message.kind !== 1 /* NapiGroupMessageKind.MembershipChange */) {
|
|
428
|
+
throw new Error("Error decoding group membership change");
|
|
429
|
+
}
|
|
430
|
+
return codec.decode(message.content, this);
|
|
431
|
+
}
|
|
432
|
+
async requestHistorySync() {
|
|
433
|
+
return this.#innerClient.requestHistorySync();
|
|
434
|
+
}
|
|
435
|
+
async getInboxIdByAddress(accountAddress) {
|
|
436
|
+
return this.#innerClient.findInboxIdByAddress(accountAddress);
|
|
437
|
+
}
|
|
438
|
+
async inboxState(refreshFromNetwork = false) {
|
|
439
|
+
return this.#innerClient.inboxState(refreshFromNetwork);
|
|
440
|
+
}
|
|
441
|
+
async inboxStateFromInboxIds(inboxIds, refreshFromNetwork) {
|
|
442
|
+
return this.#innerClient.addressesFromInboxId(refreshFromNetwork ?? false, inboxIds);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export { ApiUrls, Client, ContentTypeGroupUpdated, Conversation, Conversations, DecodedMessage, GroupUpdatedCodec };
|
|
447
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/codecs/GroupUpdatedCodec.ts","../src/AsyncStream.ts","../src/helpers/date.ts","../src/DecodedMessage.ts","../src/Conversation.ts","../src/Conversations.ts","../src/Client.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;AAOa,MAAA,uBAAuB,GAAG,IAAI,aAAa,CAAC;AACvD,IAAA,WAAW,EAAE,UAAU;AACvB,IAAA,MAAM,EAAE,eAAe;AACvB,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,YAAY,EAAE,CAAC;AAChB,CAAA,EAAE;MAEU,iBAAiB,CAAA;AAG5B,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,uBAAuB,CAAC;KAChC;AAED,IAAA,MAAM,CAAC,OAA2C,EAAA;QAChD,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW;AACtB,YAAA,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,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E,WAA0B,EAAA;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,CAAgB,aAAA,EAAA,WAAW,CAAC,QAAQ,EAAE,CAAE,CAAA,CAAC,CAAC;SAC3D;;AAGD,QAAA,IACE,WAAW,CAAC,MAAM,CAAC,uBAAuB,CAAC;AAC3C,YAAA,OAAO,CAAC,IAAI,KAA0C,CAAA,8CACtD;AACA,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAyB,EAAE,IAAI,CAAC,CAAC;KAC9D;AAED,IAAA,MAAM,kBAAkB,GAAA;AACtB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;KAC/C;IAED,MAAM,mBAAmB,CAAC,cAAsB,EAAA;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;KAC/D;AAED,IAAA,MAAM,UAAU,CAAC,kBAAA,GAA8B,KAAK,EAAA;QAClD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;KACzD;AAED,IAAA,MAAM,sBAAsB,CAC1B,QAAkB,EAClB,kBAA4B,EAAA;AAE5B,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAC3C,kBAAkB,IAAI,KAAK,EAC3B,QAAQ,CACT,CAAC;KACH;AACF;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xmtp/node-sdk",
|
|
3
|
+
"version": "0.0.17",
|
|
4
|
+
"description": "XMTP Node client SDK for interacting with XMTP networks",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"xmtp",
|
|
7
|
+
"messaging",
|
|
8
|
+
"web3",
|
|
9
|
+
"js",
|
|
10
|
+
"javascript",
|
|
11
|
+
"node",
|
|
12
|
+
"nodejs"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/xmtp/xmtp-js",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/xmtp/xmtp-js/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://git@github.com/xmtp/xmtp-js.git",
|
|
21
|
+
"directory": "packages/node-sdk"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "XMTP Labs <eng@xmtp.com>",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "dist/index.cjs",
|
|
34
|
+
"module": "dist/index.js",
|
|
35
|
+
"types": "dist/index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "yarn clean:dist && rollup -c",
|
|
41
|
+
"clean": "rimraf .turbo && yarn clean:dbs && yarn clean:dist && yarn clean:deps && yarn clean:tests",
|
|
42
|
+
"clean:dbs": "rimraf *.db3* ||:",
|
|
43
|
+
"clean:deps": "rimraf node_modules",
|
|
44
|
+
"clean:dist": "rimraf dist",
|
|
45
|
+
"clean:tests": "rimraf test/*.db3* ||:",
|
|
46
|
+
"lint": "eslint . --ignore-path ../../.gitignore",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:cov": "vitest run --coverage",
|
|
49
|
+
"typecheck": "tsc"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@xmtp/content-type-primitives": "^1.0.1",
|
|
53
|
+
"@xmtp/content-type-text": "^1.0.0",
|
|
54
|
+
"@xmtp/node-bindings": "^0.0.13",
|
|
55
|
+
"@xmtp/proto": "^3.62.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
59
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
|
60
|
+
"@types/node": "^20.14.10",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
62
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
63
|
+
"@vitest/coverage-v8": "^2.1.2",
|
|
64
|
+
"@xmtp/xmtp-js": "workspace:^",
|
|
65
|
+
"eslint": "^8.57.0",
|
|
66
|
+
"eslint-config-prettier": "^9.1.0",
|
|
67
|
+
"eslint-config-standard": "^17.1.0",
|
|
68
|
+
"eslint-plugin-import": "^2.29.1",
|
|
69
|
+
"eslint-plugin-n": "^17.9.0",
|
|
70
|
+
"eslint-plugin-node": "^11.1.0",
|
|
71
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
72
|
+
"eslint-plugin-promise": "^6.4.0",
|
|
73
|
+
"fast-glob": "^3.3.2",
|
|
74
|
+
"rimraf": "^6.0.1",
|
|
75
|
+
"rollup": "^4.24.0",
|
|
76
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
77
|
+
"rollup-plugin-filesize": "^10.0.0",
|
|
78
|
+
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
79
|
+
"typescript": "^5.6.3",
|
|
80
|
+
"viem": "^2.13.6",
|
|
81
|
+
"vite": "5.4.8",
|
|
82
|
+
"vite-tsconfig-paths": "^5.0.1",
|
|
83
|
+
"vitest": "^2.1.2"
|
|
84
|
+
},
|
|
85
|
+
"packageManager": "yarn@4.3.1",
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=20"
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public",
|
|
91
|
+
"provenance": true,
|
|
92
|
+
"registry": "https://registry.npmjs.org/"
|
|
93
|
+
}
|
|
94
|
+
}
|