simplex-chat 0.0.1 → 0.1.1
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 +29 -26
- package/dist/client.d.ts +34 -12
- package/dist/client.js +168 -113
- package/dist/client.js.map +1 -1
- package/dist/command.d.ts +134 -9
- package/dist/command.js +63 -13
- package/dist/command.js.map +1 -1
- package/dist/index-web.d.ts +0 -1
- package/dist/index-web.js +5 -2
- package/dist/index-web.js.map +1 -1
- package/dist/index.bundle.js +9 -535
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/queue.js +7 -2
- package/dist/queue.js.map +1 -1
- package/dist/response.d.ts +297 -9
- package/dist/response.js +20 -1
- package/dist/response.js.map +1 -1
- package/dist/transport.js +18 -9
- package/dist/transport.js.map +1 -1
- package/package.json +2 -1
package/dist/response.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type ChatResponse = CRActiveUser | CRChatStarted | CRChatRunning | CRApiChats | CRApiChat | CRApiParsedMarkdown | CRUserSMPServers | CRNewChatItem | CRChatItemStatusUpdated | CRChatItemUpdated | CRChatItemDeleted | CRMsgIntegrityError | CRCmdOk | CRUserContactLink | CRUserContactLinkUpdated | CRContactRequestRejected | CRUserProfile | CRUserProfileNoChange | CRUserProfileUpdated | CRInvitation | CRSentConfirmation | CRSentInvitation | CRContactUpdated | CRContactDeleted | CRUserContactLinkCreated | CRUserContactLinkDeleted | CRReceivedContactRequest | CRAcceptingContactRequest | CRContactAlreadyExists | CRContactRequestAlreadyAccepted | CRContactConnecting | CRContactConnected | CRContactAnotherClient | CRContactDisconnected | CRContactSubscribed | CRContactSubError | CRContactSubSummary | CRGroupEmpty | CRPendingSubSummary | CRUserContactLinkSubscribed | CRUserContactLinkSubError | CRMessageError | CRChatCmdError | CRChatError;
|
|
3
|
-
declare type ChatResponseTag = "activeUser" | "chatStarted" | "chatRunning" | "apiChats" | "apiChat" | "apiParsedMarkdown" | "userSMPServers" | "newChatItem" | "chatItemStatusUpdated" | "chatItemUpdated" | "chatItemDeleted" | "msgIntegrityError" | "cmdOk" | "userContactLink" | "userContactLinkUpdated" | "userContactLinkCreated" | "userContactLinkDeleted" | "contactRequestRejected" | "userProfile" | "userProfileNoChange" | "userProfileUpdated" | "invitation" | "sentConfirmation" | "sentInvitation" | "contactUpdated" | "contactDeleted" | "receivedContactRequest" | "acceptingContactRequest" | "contactAlreadyExists" | "contactRequestAlreadyAccepted" | "contactConnecting" | "contactConnected" | "contactAnotherClient" | "contactDisconnected" | "contactSubscribed" | "contactSubError" | "contactSubSummary" | "groupEmpty" | "pendingSubSummary" | "userContactLinkSubscribed" | "userContactLinkSubError" | "messageError" | "chatCmdError" | "chatError";
|
|
1
|
+
import { ChatItemId, MsgContent, DeleteMode, Profile, GroupMemberRole } from "./command";
|
|
2
|
+
export declare type ChatResponse = CRActiveUser | CRChatStarted | CRChatRunning | CRChatStopped | CRApiChats | CRApiChat | CRApiParsedMarkdown | CRUserSMPServers | CRContactInfo | CRGroupMemberInfo | CRNewChatItem | CRChatItemStatusUpdated | CRChatItemUpdated | CRChatItemDeleted | CRMsgIntegrityError | CRCmdOk | CRUserContactLink | CRUserContactLinkUpdated | CRContactRequestRejected | CRUserProfile | CRUserProfileNoChange | CRUserProfileUpdated | CRContactAliasUpdated | CRInvitation | CRSentConfirmation | CRSentInvitation | CRContactUpdated | CRContactsMerged | CRContactDeleted | CRChatCleared | CRUserContactLinkCreated | CRUserContactLinkDeleted | CRReceivedContactRequest | CRAcceptingContactRequest | CRContactAlreadyExists | CRContactRequestAlreadyAccepted | CRContactConnecting | CRContactConnected | CRContactAnotherClient | CRContactDisconnected | CRContactSubscribed | CRContactSubError | CRContactSubSummary | CRContactsDisconnected | CRContactsSubscribed | CRHostConnected | CRHostDisconnected | CRGroupEmpty | CRMemberSubError | CRMemberSubSummary | CRGroupSubscribed | CRRcvFileAccepted | CRRcvFileAcceptedSndCancelled | CRRcvFileStart | CRRcvFileComplete | CRRcvFileCancelled | CRRcvFileSndCancelled | CRSndFileStart | CRSndFileComplete | CRSndFileCancelled | CRSndFileRcvCancelled | CRSndGroupFileCancelled | CRSndFileSubError | CRRcvFileSubError | CRPendingSubSummary | CRGroupCreated | CRGroupMembers | CRUserAcceptedGroupSent | CRUserDeletedMember | CRSentGroupInvitation | CRLeftMemberUser | CRGroupDeletedUser | CRGroupInvitation | CRReceivedGroupInvitation | CRUserJoinedGroup | CRJoinedGroupMember | CRJoinedGroupMemberConnecting | CRConnectedToGroupMember | CRDeletedMember | CRDeletedMemberUser | CRLeftMember | CRGroupRemoved | CRGroupDeleted | CRGroupUpdated | CRUserContactLinkSubscribed | CRUserContactLinkSubError | CRNewContactConnection | CRContactConnectionDeleted | CRMessageError | CRChatCmdError | CRChatError;
|
|
3
|
+
declare type ChatResponseTag = "activeUser" | "chatStarted" | "chatRunning" | "chatStopped" | "apiChats" | "apiChat" | "apiParsedMarkdown" | "userSMPServers" | "contactInfo" | "groupMemberInfo" | "newChatItem" | "chatItemStatusUpdated" | "chatItemUpdated" | "chatItemDeleted" | "msgIntegrityError" | "cmdOk" | "userContactLink" | "userContactLinkUpdated" | "userContactLinkCreated" | "userContactLinkDeleted" | "contactRequestRejected" | "userProfile" | "userProfileNoChange" | "userProfileUpdated" | "contactAliasUpdated" | "invitation" | "sentConfirmation" | "sentInvitation" | "contactUpdated" | "contactsMerged" | "contactDeleted" | "chatCleared" | "receivedContactRequest" | "acceptingContactRequest" | "contactAlreadyExists" | "contactRequestAlreadyAccepted" | "contactConnecting" | "contactConnected" | "contactAnotherClient" | "contactDisconnected" | "contactSubscribed" | "contactSubError" | "contactSubSummary" | "contactsDisconnected" | "contactsSubscribed" | "hostConnected" | "hostDisconnected" | "groupEmpty" | "memberSubError" | "memberSubSummary" | "groupSubscribed" | "rcvFileAccepted" | "rcvFileAcceptedSndCancelled" | "rcvFileStart" | "rcvFileComplete" | "rcvFileCancelled" | "rcvFileSndCancelled" | "sndFileStart" | "sndFileComplete" | "sndFileCancelled" | "sndFileRcvCancelled" | "sndGroupFileCancelled" | "fileTransferStatus" | "sndFileSubError" | "rcvFileSubError" | "pendingSubSummary" | "groupCreated" | "groupMembers" | "userAcceptedGroupSent" | "userDeletedMember" | "sentGroupInvitation" | "leftMemberUser" | "groupDeletedUser" | "groupInvitation" | "receivedGroupInvitation" | "userJoinedGroup" | "joinedGroupMember" | "joinedGroupMemberConnecting" | "connectedToGroupMember" | "deletedMember" | "deletedMemberUser" | "leftMember" | "groupRemoved" | "groupDeleted" | "groupUpdated" | "userContactLinkSubscribed" | "userContactLinkSubError" | "newContactConnection" | "contactConnectionDeleted" | "messageError" | "chatCmdError" | "chatError";
|
|
4
4
|
interface CR {
|
|
5
5
|
type: ChatResponseTag;
|
|
6
6
|
}
|
|
@@ -14,6 +14,9 @@ export interface CRChatStarted extends CR {
|
|
|
14
14
|
export interface CRChatRunning extends CR {
|
|
15
15
|
type: "chatRunning";
|
|
16
16
|
}
|
|
17
|
+
export interface CRChatStopped extends CR {
|
|
18
|
+
type: "chatStopped";
|
|
19
|
+
}
|
|
17
20
|
export interface CRApiChats extends CR {
|
|
18
21
|
type: "apiChats";
|
|
19
22
|
chats: Chat[];
|
|
@@ -30,6 +33,18 @@ export interface CRUserSMPServers extends CR {
|
|
|
30
33
|
type: "userSMPServers";
|
|
31
34
|
smpServers: string[];
|
|
32
35
|
}
|
|
36
|
+
export interface CRContactInfo extends CR {
|
|
37
|
+
type: "contactInfo";
|
|
38
|
+
contact: Contact;
|
|
39
|
+
connectionStats: ConnectionStats;
|
|
40
|
+
customUserProfile?: Profile;
|
|
41
|
+
}
|
|
42
|
+
export interface CRGroupMemberInfo extends CR {
|
|
43
|
+
type: "groupMemberInfo";
|
|
44
|
+
groupInfo: GroupInfo;
|
|
45
|
+
member: GroupMember;
|
|
46
|
+
connectionStats_?: ConnectionStats;
|
|
47
|
+
}
|
|
33
48
|
export interface CRNewChatItem extends CR {
|
|
34
49
|
type: "newChatItem";
|
|
35
50
|
chatItem: AChatItem;
|
|
@@ -56,13 +71,13 @@ export interface CRCmdOk extends CR {
|
|
|
56
71
|
}
|
|
57
72
|
export interface CRUserContactLink extends CR {
|
|
58
73
|
type: "userContactLink";
|
|
59
|
-
|
|
60
|
-
autoAccept: boolean;
|
|
74
|
+
contactLink: UserContactLink;
|
|
61
75
|
}
|
|
62
76
|
export interface CRUserContactLinkUpdated extends CR {
|
|
63
77
|
type: "userContactLinkUpdated";
|
|
64
78
|
connReqContact: string;
|
|
65
79
|
autoAccept: boolean;
|
|
80
|
+
autoReply?: MsgContent;
|
|
66
81
|
}
|
|
67
82
|
export interface CRContactRequestRejected extends CR {
|
|
68
83
|
type: "contactRequestRejected";
|
|
@@ -80,6 +95,10 @@ export interface CRUserProfileUpdated extends CR {
|
|
|
80
95
|
fromProfile: Profile;
|
|
81
96
|
toProfile: Profile;
|
|
82
97
|
}
|
|
98
|
+
export interface CRContactAliasUpdated extends CR {
|
|
99
|
+
type: "contactAliasUpdated";
|
|
100
|
+
toContact: Contact;
|
|
101
|
+
}
|
|
83
102
|
export interface CRInvitation extends CR {
|
|
84
103
|
type: "invitation";
|
|
85
104
|
connReqInvitation: string;
|
|
@@ -95,10 +114,19 @@ export interface CRContactUpdated extends CR {
|
|
|
95
114
|
fromContact: Contact;
|
|
96
115
|
toContact: Contact;
|
|
97
116
|
}
|
|
117
|
+
export interface CRContactsMerged extends CR {
|
|
118
|
+
type: "contactsMerged";
|
|
119
|
+
intoContact: Contact;
|
|
120
|
+
mergedContact: Contact;
|
|
121
|
+
}
|
|
98
122
|
export interface CRContactDeleted extends CR {
|
|
99
123
|
type: "contactDeleted";
|
|
100
124
|
contact: Contact;
|
|
101
125
|
}
|
|
126
|
+
export interface CRChatCleared extends CR {
|
|
127
|
+
type: "chatCleared";
|
|
128
|
+
chatInfo: ChatInfo;
|
|
129
|
+
}
|
|
102
130
|
export interface CRUserContactLinkCreated extends CR {
|
|
103
131
|
type: "userContactLinkCreated";
|
|
104
132
|
connReqContact: string;
|
|
@@ -129,6 +157,7 @@ export interface CRContactConnecting extends CR {
|
|
|
129
157
|
export interface CRContactConnected extends CR {
|
|
130
158
|
type: "contactConnected";
|
|
131
159
|
contact: Contact;
|
|
160
|
+
userCustomProfile?: Profile;
|
|
132
161
|
}
|
|
133
162
|
export interface CRContactAnotherClient extends CR {
|
|
134
163
|
type: "contactAnotherClient";
|
|
@@ -151,14 +180,202 @@ export interface CRContactSubSummary extends CR {
|
|
|
151
180
|
type: "contactSubSummary";
|
|
152
181
|
contactSubscriptions: ContactSubStatus[];
|
|
153
182
|
}
|
|
183
|
+
export interface CRContactsDisconnected extends CR {
|
|
184
|
+
type: "contactsDisconnected";
|
|
185
|
+
server: string;
|
|
186
|
+
contactRefs: ContactRef[];
|
|
187
|
+
}
|
|
188
|
+
export interface CRContactsSubscribed extends CR {
|
|
189
|
+
type: "contactsSubscribed";
|
|
190
|
+
server: string;
|
|
191
|
+
contactRefs: ContactRef[];
|
|
192
|
+
}
|
|
193
|
+
export interface CRHostConnected extends CR {
|
|
194
|
+
type: "hostConnected";
|
|
195
|
+
protocol: string;
|
|
196
|
+
transportHost: string;
|
|
197
|
+
}
|
|
198
|
+
export interface CRHostDisconnected extends CR {
|
|
199
|
+
type: "hostDisconnected";
|
|
200
|
+
protocol: string;
|
|
201
|
+
transportHost: string;
|
|
202
|
+
}
|
|
154
203
|
export interface CRGroupEmpty extends CR {
|
|
155
204
|
type: "groupEmpty";
|
|
156
205
|
groupInfo: GroupInfo;
|
|
157
206
|
}
|
|
207
|
+
export interface CRMemberSubError extends CR {
|
|
208
|
+
type: "memberSubError";
|
|
209
|
+
groupInfo: GroupInfo;
|
|
210
|
+
member: GroupMember;
|
|
211
|
+
chatError: ChatError;
|
|
212
|
+
}
|
|
213
|
+
export interface CRMemberSubSummary extends CR {
|
|
214
|
+
type: "memberSubSummary";
|
|
215
|
+
memberSubscriptions: MemberSubStatus[];
|
|
216
|
+
}
|
|
217
|
+
export interface CRGroupSubscribed extends CR {
|
|
218
|
+
type: "groupSubscribed";
|
|
219
|
+
groupInfo: GroupInfo;
|
|
220
|
+
}
|
|
221
|
+
export interface CRRcvFileAccepted extends CR {
|
|
222
|
+
type: "rcvFileAccepted";
|
|
223
|
+
chatItem: AChatItem;
|
|
224
|
+
}
|
|
225
|
+
export interface CRRcvFileAcceptedSndCancelled extends CR {
|
|
226
|
+
type: "rcvFileAcceptedSndCancelled";
|
|
227
|
+
rcvFileTransfer: RcvFileTransfer;
|
|
228
|
+
}
|
|
229
|
+
export interface CRRcvFileStart extends CR {
|
|
230
|
+
type: "rcvFileStart";
|
|
231
|
+
chatItem: AChatItem;
|
|
232
|
+
}
|
|
233
|
+
export interface CRRcvFileComplete extends CR {
|
|
234
|
+
type: "rcvFileComplete";
|
|
235
|
+
chatItem: AChatItem;
|
|
236
|
+
}
|
|
237
|
+
export interface CRRcvFileCancelled extends CR {
|
|
238
|
+
type: "rcvFileCancelled";
|
|
239
|
+
rcvFileTransfer: RcvFileTransfer;
|
|
240
|
+
}
|
|
241
|
+
export interface CRRcvFileSndCancelled extends CR {
|
|
242
|
+
type: "rcvFileSndCancelled";
|
|
243
|
+
rcvFileTransfer: RcvFileTransfer;
|
|
244
|
+
}
|
|
245
|
+
export interface CRSndFileStart extends CR {
|
|
246
|
+
type: "sndFileStart";
|
|
247
|
+
chatItem: AChatItem;
|
|
248
|
+
sndFileTransfer: SndFileTransfer;
|
|
249
|
+
}
|
|
250
|
+
export interface CRSndFileComplete extends CR {
|
|
251
|
+
type: "sndFileComplete";
|
|
252
|
+
chatItem: AChatItem;
|
|
253
|
+
sndFileTransfer: SndFileTransfer;
|
|
254
|
+
}
|
|
255
|
+
export interface CRSndFileCancelled extends CR {
|
|
256
|
+
type: "sndFileCancelled";
|
|
257
|
+
chatItem: AChatItem;
|
|
258
|
+
sndFileTransfer: SndFileTransfer;
|
|
259
|
+
}
|
|
260
|
+
export interface CRSndFileRcvCancelled extends CR {
|
|
261
|
+
type: "sndFileRcvCancelled";
|
|
262
|
+
chatItem: AChatItem;
|
|
263
|
+
sndFileTransfer: SndFileTransfer;
|
|
264
|
+
}
|
|
265
|
+
export interface CRSndGroupFileCancelled extends CR {
|
|
266
|
+
type: "sndGroupFileCancelled";
|
|
267
|
+
chatItem: AChatItem;
|
|
268
|
+
fileTransferMeta: FileTransferMeta;
|
|
269
|
+
sndFileTransfers: SndFileTransfer[];
|
|
270
|
+
}
|
|
271
|
+
export interface CRSndFileSubError extends CR {
|
|
272
|
+
type: "sndFileSubError";
|
|
273
|
+
sndFileTransfer: SndFileTransfer;
|
|
274
|
+
chatError: ChatError;
|
|
275
|
+
}
|
|
276
|
+
export interface CRRcvFileSubError extends CR {
|
|
277
|
+
type: "rcvFileSubError";
|
|
278
|
+
rcvFileTransfer: RcvFileTransfer;
|
|
279
|
+
chatError: ChatError;
|
|
280
|
+
}
|
|
158
281
|
export interface CRPendingSubSummary extends CR {
|
|
159
282
|
type: "pendingSubSummary";
|
|
160
283
|
pendingSubStatus: PendingSubStatus[];
|
|
161
284
|
}
|
|
285
|
+
export interface CRGroupCreated extends CR {
|
|
286
|
+
type: "groupCreated";
|
|
287
|
+
groupInfo: GroupInfo;
|
|
288
|
+
}
|
|
289
|
+
export interface CRGroupMembers extends CR {
|
|
290
|
+
type: "groupMembers";
|
|
291
|
+
group: Group;
|
|
292
|
+
}
|
|
293
|
+
export interface CRUserAcceptedGroupSent extends CR {
|
|
294
|
+
type: "userAcceptedGroupSent";
|
|
295
|
+
groupInfo: GroupInfo;
|
|
296
|
+
hostContact?: Contact;
|
|
297
|
+
}
|
|
298
|
+
export interface CRUserDeletedMember extends CR {
|
|
299
|
+
type: "userDeletedMember";
|
|
300
|
+
groupInfo: GroupInfo;
|
|
301
|
+
member: GroupMember;
|
|
302
|
+
}
|
|
303
|
+
export interface CRSentGroupInvitation extends CR {
|
|
304
|
+
type: "sentGroupInvitation";
|
|
305
|
+
groupInfo: GroupInfo;
|
|
306
|
+
contact: Contact;
|
|
307
|
+
member: GroupMember;
|
|
308
|
+
}
|
|
309
|
+
export interface CRLeftMemberUser extends CR {
|
|
310
|
+
type: "leftMemberUser";
|
|
311
|
+
groupInfo: GroupInfo;
|
|
312
|
+
}
|
|
313
|
+
export interface CRGroupDeletedUser extends CR {
|
|
314
|
+
type: "groupDeletedUser";
|
|
315
|
+
groupInfo: GroupInfo;
|
|
316
|
+
}
|
|
317
|
+
export interface CRGroupInvitation extends CR {
|
|
318
|
+
type: "groupInvitation";
|
|
319
|
+
groupInfo: GroupInfo;
|
|
320
|
+
}
|
|
321
|
+
export interface CRReceivedGroupInvitation extends CR {
|
|
322
|
+
type: "receivedGroupInvitation";
|
|
323
|
+
groupInfo: GroupInfo;
|
|
324
|
+
contact: Contact;
|
|
325
|
+
memberRole: GroupMemberRole;
|
|
326
|
+
}
|
|
327
|
+
export interface CRUserJoinedGroup extends CR {
|
|
328
|
+
type: "userJoinedGroup";
|
|
329
|
+
groupInfo: GroupInfo;
|
|
330
|
+
hostMember: GroupMember;
|
|
331
|
+
}
|
|
332
|
+
export interface CRJoinedGroupMember extends CR {
|
|
333
|
+
type: "joinedGroupMember";
|
|
334
|
+
groupInfo: GroupInfo;
|
|
335
|
+
member: GroupMember;
|
|
336
|
+
}
|
|
337
|
+
export interface CRJoinedGroupMemberConnecting extends CR {
|
|
338
|
+
type: "joinedGroupMemberConnecting";
|
|
339
|
+
groupInfo: GroupInfo;
|
|
340
|
+
hostMember: GroupMember;
|
|
341
|
+
member: GroupMember;
|
|
342
|
+
}
|
|
343
|
+
export interface CRConnectedToGroupMember extends CR {
|
|
344
|
+
type: "connectedToGroupMember";
|
|
345
|
+
groupInfo: GroupInfo;
|
|
346
|
+
member: GroupMember;
|
|
347
|
+
}
|
|
348
|
+
export interface CRDeletedMember extends CR {
|
|
349
|
+
type: "deletedMember";
|
|
350
|
+
groupInfo: GroupInfo;
|
|
351
|
+
byMember: GroupMember;
|
|
352
|
+
deletedMember: GroupMember;
|
|
353
|
+
}
|
|
354
|
+
export interface CRDeletedMemberUser extends CR {
|
|
355
|
+
type: "deletedMemberUser";
|
|
356
|
+
groupInfo: GroupInfo;
|
|
357
|
+
member: GroupMember;
|
|
358
|
+
}
|
|
359
|
+
export interface CRLeftMember extends CR {
|
|
360
|
+
type: "leftMember";
|
|
361
|
+
groupInfo: GroupInfo;
|
|
362
|
+
member: GroupMember;
|
|
363
|
+
}
|
|
364
|
+
export interface CRGroupRemoved extends CR {
|
|
365
|
+
type: "groupRemoved";
|
|
366
|
+
groupInfo: GroupInfo;
|
|
367
|
+
}
|
|
368
|
+
export interface CRGroupDeleted extends CR {
|
|
369
|
+
type: "groupDeleted";
|
|
370
|
+
groupInfo: GroupInfo;
|
|
371
|
+
member: GroupMember;
|
|
372
|
+
}
|
|
373
|
+
export interface CRGroupUpdated extends CR {
|
|
374
|
+
type: "groupUpdated";
|
|
375
|
+
fromGroup: GroupInfo;
|
|
376
|
+
toGroup: GroupInfo;
|
|
377
|
+
member_?: GroupMember;
|
|
378
|
+
}
|
|
162
379
|
export interface CRUserContactLinkSubscribed extends CR {
|
|
163
380
|
type: "userContactLinkSubscribed";
|
|
164
381
|
}
|
|
@@ -166,6 +383,14 @@ export interface CRUserContactLinkSubError extends CR {
|
|
|
166
383
|
type: "userContactLinkSubError";
|
|
167
384
|
chatError: ChatError;
|
|
168
385
|
}
|
|
386
|
+
export interface CRNewContactConnection extends CR {
|
|
387
|
+
type: "newContactConnection";
|
|
388
|
+
connection: PendingContactConnection;
|
|
389
|
+
}
|
|
390
|
+
export interface CRContactConnectionDeleted extends CR {
|
|
391
|
+
type: "contactConnectionDeleted";
|
|
392
|
+
connection: PendingContactConnection;
|
|
393
|
+
}
|
|
169
394
|
export interface CRMessageError extends CR {
|
|
170
395
|
type: "messageError";
|
|
171
396
|
severity: string;
|
|
@@ -192,19 +417,24 @@ export interface Chat {
|
|
|
192
417
|
chatStats: ChatStats;
|
|
193
418
|
}
|
|
194
419
|
export declare type ChatInfo = CInfoDirect | CInfoGroup | CInfoContactRequest;
|
|
420
|
+
export declare enum ChatInfoType {
|
|
421
|
+
Direct = "direct",
|
|
422
|
+
Group = "group",
|
|
423
|
+
ContactRequest = "contactRequest"
|
|
424
|
+
}
|
|
195
425
|
interface IChatInfo {
|
|
196
|
-
type:
|
|
426
|
+
type: ChatInfoType;
|
|
197
427
|
}
|
|
198
428
|
interface CInfoDirect extends IChatInfo {
|
|
199
|
-
type:
|
|
429
|
+
type: ChatInfoType.Direct;
|
|
200
430
|
contact: Contact;
|
|
201
431
|
}
|
|
202
432
|
interface CInfoGroup extends IChatInfo {
|
|
203
|
-
type:
|
|
433
|
+
type: ChatInfoType.Group;
|
|
204
434
|
groupInfo: GroupInfo;
|
|
205
435
|
}
|
|
206
436
|
interface CInfoContactRequest extends IChatInfo {
|
|
207
|
-
type:
|
|
437
|
+
type: ChatInfoType.ContactRequest;
|
|
208
438
|
contactRequest: UserContactRequest;
|
|
209
439
|
}
|
|
210
440
|
export interface Contact {
|
|
@@ -215,6 +445,14 @@ export interface Contact {
|
|
|
215
445
|
viaGroup?: number;
|
|
216
446
|
createdAt: Date;
|
|
217
447
|
}
|
|
448
|
+
export interface ContactRef {
|
|
449
|
+
contactId: number;
|
|
450
|
+
localDisplayName: string;
|
|
451
|
+
}
|
|
452
|
+
export interface Group {
|
|
453
|
+
groupInfo: GroupInfo;
|
|
454
|
+
members: GroupMember[];
|
|
455
|
+
}
|
|
218
456
|
export interface GroupInfo {
|
|
219
457
|
groupId: number;
|
|
220
458
|
localDisplayName: string;
|
|
@@ -230,6 +468,7 @@ export interface GroupProfile {
|
|
|
230
468
|
export interface GroupMember {
|
|
231
469
|
groupMemberId: number;
|
|
232
470
|
memberId: string;
|
|
471
|
+
memberRole: GroupMemberRole;
|
|
233
472
|
localDisplayName: string;
|
|
234
473
|
memberProfile: Profile;
|
|
235
474
|
memberContactId?: number;
|
|
@@ -311,7 +550,38 @@ interface CIRcvFileInvitation extends ICIContent {
|
|
|
311
550
|
type: "rcvFileInvitation";
|
|
312
551
|
rcvFileTransfer: RcvFileTransfer;
|
|
313
552
|
}
|
|
553
|
+
export declare function ciContentText(content: CIContent): string | undefined;
|
|
314
554
|
interface RcvFileTransfer {
|
|
555
|
+
fileId: number;
|
|
556
|
+
senderDisplayName: string;
|
|
557
|
+
chunkSize: number;
|
|
558
|
+
cancelled: boolean;
|
|
559
|
+
grpMemberId?: number;
|
|
560
|
+
}
|
|
561
|
+
interface SndFileTransfer {
|
|
562
|
+
fileId: number;
|
|
563
|
+
fileName: string;
|
|
564
|
+
filePath: string;
|
|
565
|
+
fileSize: number;
|
|
566
|
+
chunkSize: number;
|
|
567
|
+
recipientDisplayName: string;
|
|
568
|
+
connId: number;
|
|
569
|
+
}
|
|
570
|
+
interface FileTransferMeta {
|
|
571
|
+
fileId: number;
|
|
572
|
+
fileName: string;
|
|
573
|
+
filePath: string;
|
|
574
|
+
fileSize: number;
|
|
575
|
+
chunkSize: number;
|
|
576
|
+
cancelled: boolean;
|
|
577
|
+
}
|
|
578
|
+
interface UserContactLink {
|
|
579
|
+
connReqContact: string;
|
|
580
|
+
autoAccept?: AutoAccept;
|
|
581
|
+
}
|
|
582
|
+
interface AutoAccept {
|
|
583
|
+
acceptIncognito: boolean;
|
|
584
|
+
autoReply?: MsgContent;
|
|
315
585
|
}
|
|
316
586
|
export interface ChatStats {
|
|
317
587
|
unreadCount: number;
|
|
@@ -359,9 +629,11 @@ interface ChatErrorChat {
|
|
|
359
629
|
}
|
|
360
630
|
interface ChatErrorAgent {
|
|
361
631
|
type: "errorAgent";
|
|
632
|
+
agentError: AgentErrorType;
|
|
362
633
|
}
|
|
363
634
|
interface ChatErrorStore {
|
|
364
635
|
type: "errorStore";
|
|
636
|
+
storeError: StoreErrorType;
|
|
365
637
|
}
|
|
366
638
|
declare type ChatErrorType = CENoActiveUser | CEActiveUserExists;
|
|
367
639
|
interface CENoActiveUser {
|
|
@@ -374,6 +646,22 @@ interface ContactSubStatus {
|
|
|
374
646
|
}
|
|
375
647
|
interface PendingSubStatus {
|
|
376
648
|
}
|
|
649
|
+
export interface ConnectionStats {
|
|
650
|
+
rcvServers?: string[];
|
|
651
|
+
sndServers?: string[];
|
|
652
|
+
}
|
|
653
|
+
interface PendingContactConnection {
|
|
654
|
+
}
|
|
655
|
+
interface MemberSubStatus {
|
|
656
|
+
member: GroupMember;
|
|
657
|
+
memberError?: ChatError;
|
|
658
|
+
}
|
|
377
659
|
interface AgentErrorType {
|
|
660
|
+
type: string;
|
|
661
|
+
[x: string]: any;
|
|
662
|
+
}
|
|
663
|
+
interface StoreErrorType {
|
|
664
|
+
type: string;
|
|
665
|
+
[x: string]: any;
|
|
378
666
|
}
|
|
379
667
|
export {};
|
package/dist/response.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ciContentText = exports.ChatInfoType = void 0;
|
|
4
|
+
var ChatInfoType;
|
|
5
|
+
(function (ChatInfoType) {
|
|
6
|
+
ChatInfoType["Direct"] = "direct";
|
|
7
|
+
ChatInfoType["Group"] = "group";
|
|
8
|
+
ChatInfoType["ContactRequest"] = "contactRequest";
|
|
9
|
+
})(ChatInfoType = exports.ChatInfoType || (exports.ChatInfoType = {}));
|
|
10
|
+
function ciContentText(content) {
|
|
11
|
+
switch (content.type) {
|
|
12
|
+
case "sndMsgContent":
|
|
13
|
+
return content.msgContent.text;
|
|
14
|
+
case "rcvMsgContent":
|
|
15
|
+
return content.msgContent.text;
|
|
16
|
+
default:
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ciContentText = ciContentText;
|
|
2
21
|
//# sourceMappingURL=response.js.map
|
package/dist/response.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":";;;AAksBA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;IACf,iDAAiC,CAAA;AACnC,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAkKD,SAAgB,aAAa,CAAC,OAAkB;IAC9C,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,eAAe;YAClB,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA;QAChC,KAAK,eAAe;YAClB,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA;QAChC;YACE,OAAO,SAAS,CAAA;KACnB;AACH,CAAC;AATD,sCASC"}
|
package/dist/transport.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noop = exports.ChatTransport = exports.ChatResponseError = exports.localServer = exports.WSTransport = exports.Transport = exports.TransportError = void 0;
|
|
4
|
+
const queue_1 = require("./queue");
|
|
5
|
+
class TransportError extends Error {
|
|
3
6
|
}
|
|
4
|
-
|
|
7
|
+
exports.TransportError = TransportError;
|
|
8
|
+
class Transport {
|
|
5
9
|
constructor(qSize) {
|
|
6
|
-
this.queue = new ABQueue(qSize);
|
|
10
|
+
this.queue = new queue_1.ABQueue(qSize);
|
|
7
11
|
}
|
|
8
12
|
[Symbol.asyncIterator]() {
|
|
9
13
|
return this;
|
|
@@ -15,7 +19,8 @@ export class Transport {
|
|
|
15
19
|
return this.queue.next();
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
|
-
|
|
22
|
+
exports.Transport = Transport;
|
|
23
|
+
class WSTransport extends Transport {
|
|
19
24
|
constructor(sock, timeout, qSize) {
|
|
20
25
|
super(qSize);
|
|
21
26
|
this.sock = sock;
|
|
@@ -50,6 +55,7 @@ export class WSTransport extends Transport {
|
|
|
50
55
|
return data;
|
|
51
56
|
}
|
|
52
57
|
}
|
|
58
|
+
exports.WSTransport = WSTransport;
|
|
53
59
|
function withTimeout(ms, action) {
|
|
54
60
|
return Promise.race([
|
|
55
61
|
action(),
|
|
@@ -59,18 +65,19 @@ function withTimeout(ms, action) {
|
|
|
59
65
|
})(),
|
|
60
66
|
]);
|
|
61
67
|
}
|
|
62
|
-
|
|
68
|
+
exports.localServer = {
|
|
63
69
|
host: "localhost",
|
|
64
70
|
port: "5225",
|
|
65
71
|
};
|
|
66
|
-
|
|
72
|
+
class ChatResponseError extends Error {
|
|
67
73
|
constructor(message, data) {
|
|
68
74
|
super(message);
|
|
69
75
|
this.message = message;
|
|
70
76
|
this.data = data;
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
|
-
|
|
79
|
+
exports.ChatResponseError = ChatResponseError;
|
|
80
|
+
class ChatTransport extends Transport {
|
|
74
81
|
constructor(ws, timeout, qSize) {
|
|
75
82
|
super(qSize);
|
|
76
83
|
this.ws = ws;
|
|
@@ -90,7 +97,9 @@ export class ChatTransport extends Transport {
|
|
|
90
97
|
return this.ws.write(JSON.stringify(cmd));
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
|
-
|
|
100
|
+
exports.ChatTransport = ChatTransport;
|
|
101
|
+
function noop() { }
|
|
102
|
+
exports.noop = noop;
|
|
94
103
|
async function processWSQueue(c, ws) {
|
|
95
104
|
var _a;
|
|
96
105
|
for await (const data of ws) {
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AAGzC,MAAa,cAAe,SAAQ,KAAK;CAAG;AAA5C,wCAA4C;AAE5C,MAAsB,SAAS;IAG7B,YAAsB,KAAa;QACj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
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"prettier": "^2.6.2",
|
|
48
48
|
"rollup": "^2.72.1",
|
|
49
49
|
"ts-jest": "^28.0.2",
|
|
50
|
+
"ts-node": "^10.7.0",
|
|
50
51
|
"typescript": "^4.6.3"
|
|
51
52
|
},
|
|
52
53
|
"husky": {
|