simplex-chat 0.1.1 → 0.2.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.
@@ -1,6 +1,6 @@
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";
1
+ import { ChatItemId, MsgContent, DeleteMode, Profile, GroupMemberRole, LocalProfile, ServerProtocol, ServerCfg } from "./command";
2
+ export type ChatResponse = CRActiveUser | CRUsersList | CRChatStarted | CRChatRunning | CRChatStopped | CRApiChats | CRApiChat | CRApiParsedMarkdown | CRUserProtoServers | CRContactInfo | CRGroupMemberInfo | CRNewChatItems | 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 | 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 | CRContactConnectionDeleted | CRMessageError | CRChatCmdError | CRChatError;
3
+ type ChatResponseTag = "activeUser" | "usersList" | "chatStarted" | "chatRunning" | "chatStopped" | "apiChats" | "apiChat" | "apiParsedMarkdown" | "userProtoServers" | "contactInfo" | "groupMemberInfo" | "newChatItems" | "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" | "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
  }
@@ -8,6 +8,10 @@ export interface CRActiveUser extends CR {
8
8
  type: "activeUser";
9
9
  user: User;
10
10
  }
11
+ export interface CRUsersList extends CR {
12
+ type: "usersList";
13
+ users: UserInfo[];
14
+ }
11
15
  export interface CRChatStarted extends CR {
12
16
  type: "chatStarted";
13
17
  }
@@ -19,174 +23,205 @@ export interface CRChatStopped extends CR {
19
23
  }
20
24
  export interface CRApiChats extends CR {
21
25
  type: "apiChats";
26
+ user: User;
22
27
  chats: Chat[];
23
28
  }
24
29
  export interface CRApiChat extends CR {
25
30
  type: "apiChat";
31
+ user: User;
26
32
  chat: Chat;
27
33
  }
28
34
  export interface CRApiParsedMarkdown extends CR {
29
35
  type: "apiParsedMarkdown";
30
36
  formattedText?: FormattedText[];
31
37
  }
32
- export interface CRUserSMPServers extends CR {
33
- type: "userSMPServers";
34
- smpServers: string[];
38
+ export interface CRUserProtoServers extends CR {
39
+ type: "userProtoServers";
40
+ user: User;
41
+ servers: UserProtoServers;
35
42
  }
36
43
  export interface CRContactInfo extends CR {
37
44
  type: "contactInfo";
45
+ user: User;
38
46
  contact: Contact;
39
47
  connectionStats: ConnectionStats;
40
48
  customUserProfile?: Profile;
41
49
  }
42
50
  export interface CRGroupMemberInfo extends CR {
43
51
  type: "groupMemberInfo";
52
+ user: User;
44
53
  groupInfo: GroupInfo;
45
54
  member: GroupMember;
46
55
  connectionStats_?: ConnectionStats;
47
56
  }
48
- export interface CRNewChatItem extends CR {
49
- type: "newChatItem";
50
- chatItem: AChatItem;
57
+ export interface CRNewChatItems extends CR {
58
+ type: "newChatItems";
59
+ user: User;
60
+ chatItems: AChatItem[];
51
61
  }
52
62
  export interface CRChatItemStatusUpdated extends CR {
53
63
  type: "chatItemStatusUpdated";
64
+ user: User;
54
65
  chatItem: AChatItem;
55
66
  }
56
67
  export interface CRChatItemUpdated extends CR {
57
68
  type: "chatItemUpdated";
69
+ user: User;
58
70
  chatItem: AChatItem;
59
71
  }
60
72
  export interface CRChatItemDeleted extends CR {
61
73
  type: "chatItemDeleted";
74
+ user: User;
62
75
  deletedChatItem: AChatItem;
63
- toChatItem: AChatItem;
76
+ toChatItem?: AChatItem;
77
+ byUser: boolean;
64
78
  }
65
79
  export interface CRMsgIntegrityError extends CR {
66
80
  type: "msgIntegrityError";
81
+ user: User;
67
82
  msgError: MsgErrorType;
68
83
  }
69
84
  export interface CRCmdOk extends CR {
70
85
  type: "cmdOk";
86
+ user_?: User;
71
87
  }
72
88
  export interface CRUserContactLink extends CR {
73
89
  type: "userContactLink";
90
+ user: User;
74
91
  contactLink: UserContactLink;
75
92
  }
76
93
  export interface CRUserContactLinkUpdated extends CR {
77
94
  type: "userContactLinkUpdated";
95
+ user: User;
78
96
  connReqContact: string;
79
97
  autoAccept: boolean;
80
98
  autoReply?: MsgContent;
81
99
  }
82
100
  export interface CRContactRequestRejected extends CR {
83
101
  type: "contactRequestRejected";
102
+ user: User;
84
103
  contactRequest: UserContactRequest;
85
104
  }
86
105
  export interface CRUserProfile extends CR {
87
106
  type: "userProfile";
107
+ user: User;
88
108
  profile: Profile;
89
109
  }
90
110
  export interface CRUserProfileNoChange extends CR {
91
111
  type: "userProfileNoChange";
112
+ user: User;
92
113
  }
93
114
  export interface CRUserProfileUpdated extends CR {
94
115
  type: "userProfileUpdated";
116
+ user: User;
95
117
  fromProfile: Profile;
96
118
  toProfile: Profile;
97
119
  }
98
120
  export interface CRContactAliasUpdated extends CR {
99
121
  type: "contactAliasUpdated";
122
+ user: User;
100
123
  toContact: Contact;
101
124
  }
102
125
  export interface CRInvitation extends CR {
103
126
  type: "invitation";
127
+ user: User;
104
128
  connReqInvitation: string;
105
129
  }
106
130
  export interface CRSentConfirmation extends CR {
107
131
  type: "sentConfirmation";
132
+ user: User;
108
133
  }
109
134
  export interface CRSentInvitation extends CR {
110
135
  type: "sentInvitation";
136
+ user: User;
111
137
  }
112
138
  export interface CRContactUpdated extends CR {
113
139
  type: "contactUpdated";
140
+ user: User;
114
141
  fromContact: Contact;
115
142
  toContact: Contact;
116
143
  }
117
144
  export interface CRContactsMerged extends CR {
118
145
  type: "contactsMerged";
146
+ user: User;
119
147
  intoContact: Contact;
120
148
  mergedContact: Contact;
121
149
  }
122
150
  export interface CRContactDeleted extends CR {
123
151
  type: "contactDeleted";
152
+ user: User;
124
153
  contact: Contact;
125
154
  }
126
155
  export interface CRChatCleared extends CR {
127
156
  type: "chatCleared";
157
+ user: User;
128
158
  chatInfo: ChatInfo;
129
159
  }
130
160
  export interface CRUserContactLinkCreated extends CR {
131
161
  type: "userContactLinkCreated";
162
+ user: User;
132
163
  connReqContact: string;
133
164
  }
134
165
  export interface CRUserContactLinkDeleted extends CR {
135
166
  type: "userContactLinkDeleted";
167
+ user: User;
136
168
  }
137
169
  export interface CRReceivedContactRequest extends CR {
138
170
  type: "receivedContactRequest";
171
+ user: User;
139
172
  contactRequest: UserContactRequest;
140
173
  }
141
174
  export interface CRAcceptingContactRequest extends CR {
142
175
  type: "acceptingContactRequest";
176
+ user: User;
143
177
  contact: Contact;
144
178
  }
145
179
  export interface CRContactAlreadyExists extends CR {
146
180
  type: "contactAlreadyExists";
181
+ user: User;
147
182
  contact: Contact;
148
183
  }
149
184
  export interface CRContactRequestAlreadyAccepted extends CR {
150
185
  type: "contactRequestAlreadyAccepted";
186
+ user: User;
151
187
  contact: Contact;
152
188
  }
153
189
  export interface CRContactConnecting extends CR {
154
190
  type: "contactConnecting";
191
+ user: User;
155
192
  contact: Contact;
156
193
  }
157
194
  export interface CRContactConnected extends CR {
158
195
  type: "contactConnected";
159
196
  contact: Contact;
197
+ user: User;
160
198
  userCustomProfile?: Profile;
161
199
  }
162
200
  export interface CRContactAnotherClient extends CR {
163
201
  type: "contactAnotherClient";
164
- contact: Contact;
165
- }
166
- export interface CRContactDisconnected extends CR {
167
- type: "contactDisconnected";
168
- contact: Contact;
169
- }
170
- export interface CRContactSubscribed extends CR {
171
- type: "contactSubscribed";
202
+ user: User;
172
203
  contact: Contact;
173
204
  }
174
205
  export interface CRContactSubError extends CR {
175
206
  type: "contactSubError";
207
+ user: User;
176
208
  contact: Contact;
177
209
  chatError: ChatError;
178
210
  }
179
211
  export interface CRContactSubSummary extends CR {
180
212
  type: "contactSubSummary";
213
+ user: User;
181
214
  contactSubscriptions: ContactSubStatus[];
182
215
  }
183
216
  export interface CRContactsDisconnected extends CR {
184
217
  type: "contactsDisconnected";
218
+ user: User;
185
219
  server: string;
186
220
  contactRefs: ContactRef[];
187
221
  }
188
222
  export interface CRContactsSubscribed extends CR {
189
223
  type: "contactsSubscribed";
224
+ user: User;
190
225
  server: string;
191
226
  contactRefs: ContactRef[];
192
227
  }
@@ -202,176 +237,213 @@ export interface CRHostDisconnected extends CR {
202
237
  }
203
238
  export interface CRGroupEmpty extends CR {
204
239
  type: "groupEmpty";
240
+ user: User;
205
241
  groupInfo: GroupInfo;
206
242
  }
207
243
  export interface CRMemberSubError extends CR {
208
244
  type: "memberSubError";
245
+ user: User;
209
246
  groupInfo: GroupInfo;
210
247
  member: GroupMember;
211
248
  chatError: ChatError;
212
249
  }
213
250
  export interface CRMemberSubSummary extends CR {
214
251
  type: "memberSubSummary";
252
+ user: User;
215
253
  memberSubscriptions: MemberSubStatus[];
216
254
  }
217
255
  export interface CRGroupSubscribed extends CR {
218
256
  type: "groupSubscribed";
257
+ user: User;
219
258
  groupInfo: GroupInfo;
220
259
  }
221
260
  export interface CRRcvFileAccepted extends CR {
222
261
  type: "rcvFileAccepted";
262
+ user: User;
223
263
  chatItem: AChatItem;
224
264
  }
225
265
  export interface CRRcvFileAcceptedSndCancelled extends CR {
226
266
  type: "rcvFileAcceptedSndCancelled";
267
+ user: User;
227
268
  rcvFileTransfer: RcvFileTransfer;
228
269
  }
229
270
  export interface CRRcvFileStart extends CR {
230
271
  type: "rcvFileStart";
272
+ user: User;
231
273
  chatItem: AChatItem;
232
274
  }
233
275
  export interface CRRcvFileComplete extends CR {
234
276
  type: "rcvFileComplete";
277
+ user: User;
235
278
  chatItem: AChatItem;
236
279
  }
237
280
  export interface CRRcvFileCancelled extends CR {
238
281
  type: "rcvFileCancelled";
282
+ user: User;
239
283
  rcvFileTransfer: RcvFileTransfer;
240
284
  }
241
285
  export interface CRRcvFileSndCancelled extends CR {
242
286
  type: "rcvFileSndCancelled";
287
+ user: User;
243
288
  rcvFileTransfer: RcvFileTransfer;
244
289
  }
245
290
  export interface CRSndFileStart extends CR {
246
291
  type: "sndFileStart";
292
+ user: User;
247
293
  chatItem: AChatItem;
248
294
  sndFileTransfer: SndFileTransfer;
249
295
  }
250
296
  export interface CRSndFileComplete extends CR {
251
297
  type: "sndFileComplete";
298
+ user: User;
252
299
  chatItem: AChatItem;
253
300
  sndFileTransfer: SndFileTransfer;
254
301
  }
255
302
  export interface CRSndFileCancelled extends CR {
256
303
  type: "sndFileCancelled";
304
+ user: User;
257
305
  chatItem: AChatItem;
258
306
  sndFileTransfer: SndFileTransfer;
259
307
  }
260
308
  export interface CRSndFileRcvCancelled extends CR {
261
309
  type: "sndFileRcvCancelled";
310
+ user: User;
262
311
  chatItem: AChatItem;
263
312
  sndFileTransfer: SndFileTransfer;
264
313
  }
265
314
  export interface CRSndGroupFileCancelled extends CR {
266
315
  type: "sndGroupFileCancelled";
316
+ user: User;
267
317
  chatItem: AChatItem;
268
318
  fileTransferMeta: FileTransferMeta;
269
319
  sndFileTransfers: SndFileTransfer[];
270
320
  }
271
321
  export interface CRSndFileSubError extends CR {
272
322
  type: "sndFileSubError";
323
+ user: User;
273
324
  sndFileTransfer: SndFileTransfer;
274
325
  chatError: ChatError;
275
326
  }
276
327
  export interface CRRcvFileSubError extends CR {
277
328
  type: "rcvFileSubError";
329
+ user: User;
278
330
  rcvFileTransfer: RcvFileTransfer;
279
331
  chatError: ChatError;
280
332
  }
281
333
  export interface CRPendingSubSummary extends CR {
282
334
  type: "pendingSubSummary";
335
+ user: User;
283
336
  pendingSubStatus: PendingSubStatus[];
284
337
  }
285
338
  export interface CRGroupCreated extends CR {
286
339
  type: "groupCreated";
340
+ user: User;
287
341
  groupInfo: GroupInfo;
288
342
  }
289
343
  export interface CRGroupMembers extends CR {
290
344
  type: "groupMembers";
345
+ user: User;
291
346
  group: Group;
292
347
  }
293
348
  export interface CRUserAcceptedGroupSent extends CR {
294
349
  type: "userAcceptedGroupSent";
350
+ user: User;
295
351
  groupInfo: GroupInfo;
296
352
  hostContact?: Contact;
297
353
  }
298
354
  export interface CRUserDeletedMember extends CR {
299
355
  type: "userDeletedMember";
356
+ user: User;
300
357
  groupInfo: GroupInfo;
301
358
  member: GroupMember;
302
359
  }
303
360
  export interface CRSentGroupInvitation extends CR {
304
361
  type: "sentGroupInvitation";
362
+ user: User;
305
363
  groupInfo: GroupInfo;
306
364
  contact: Contact;
307
365
  member: GroupMember;
308
366
  }
309
367
  export interface CRLeftMemberUser extends CR {
310
368
  type: "leftMemberUser";
369
+ user: User;
311
370
  groupInfo: GroupInfo;
312
371
  }
313
372
  export interface CRGroupDeletedUser extends CR {
314
373
  type: "groupDeletedUser";
374
+ user: User;
315
375
  groupInfo: GroupInfo;
316
376
  }
317
377
  export interface CRGroupInvitation extends CR {
318
378
  type: "groupInvitation";
379
+ user: User;
319
380
  groupInfo: GroupInfo;
320
381
  }
321
382
  export interface CRReceivedGroupInvitation extends CR {
322
383
  type: "receivedGroupInvitation";
384
+ user: User;
323
385
  groupInfo: GroupInfo;
324
386
  contact: Contact;
325
387
  memberRole: GroupMemberRole;
326
388
  }
327
389
  export interface CRUserJoinedGroup extends CR {
328
390
  type: "userJoinedGroup";
391
+ user: User;
329
392
  groupInfo: GroupInfo;
330
393
  hostMember: GroupMember;
331
394
  }
332
395
  export interface CRJoinedGroupMember extends CR {
333
396
  type: "joinedGroupMember";
397
+ user: User;
334
398
  groupInfo: GroupInfo;
335
399
  member: GroupMember;
336
400
  }
337
401
  export interface CRJoinedGroupMemberConnecting extends CR {
338
402
  type: "joinedGroupMemberConnecting";
403
+ user: User;
339
404
  groupInfo: GroupInfo;
340
405
  hostMember: GroupMember;
341
406
  member: GroupMember;
342
407
  }
343
408
  export interface CRConnectedToGroupMember extends CR {
344
409
  type: "connectedToGroupMember";
410
+ user: User;
345
411
  groupInfo: GroupInfo;
346
412
  member: GroupMember;
347
413
  }
348
414
  export interface CRDeletedMember extends CR {
349
415
  type: "deletedMember";
416
+ user: User;
350
417
  groupInfo: GroupInfo;
351
418
  byMember: GroupMember;
352
419
  deletedMember: GroupMember;
353
420
  }
354
421
  export interface CRDeletedMemberUser extends CR {
355
422
  type: "deletedMemberUser";
423
+ user: User;
356
424
  groupInfo: GroupInfo;
357
425
  member: GroupMember;
358
426
  }
359
427
  export interface CRLeftMember extends CR {
360
428
  type: "leftMember";
429
+ user: User;
361
430
  groupInfo: GroupInfo;
362
431
  member: GroupMember;
363
432
  }
364
433
  export interface CRGroupRemoved extends CR {
365
434
  type: "groupRemoved";
435
+ user: User;
366
436
  groupInfo: GroupInfo;
367
437
  }
368
438
  export interface CRGroupDeleted extends CR {
369
439
  type: "groupDeleted";
440
+ user: User;
370
441
  groupInfo: GroupInfo;
371
442
  member: GroupMember;
372
443
  }
373
444
  export interface CRGroupUpdated extends CR {
374
445
  type: "groupUpdated";
446
+ user: User;
375
447
  fromGroup: GroupInfo;
376
448
  toGroup: GroupInfo;
377
449
  member_?: GroupMember;
@@ -383,40 +455,48 @@ export interface CRUserContactLinkSubError extends CR {
383
455
  type: "userContactLinkSubError";
384
456
  chatError: ChatError;
385
457
  }
386
- export interface CRNewContactConnection extends CR {
387
- type: "newContactConnection";
388
- connection: PendingContactConnection;
389
- }
390
458
  export interface CRContactConnectionDeleted extends CR {
391
459
  type: "contactConnectionDeleted";
460
+ user: User;
392
461
  connection: PendingContactConnection;
393
462
  }
394
463
  export interface CRMessageError extends CR {
395
464
  type: "messageError";
465
+ user: User;
396
466
  severity: string;
397
467
  errorMessage: string;
398
468
  }
399
469
  export interface CRChatCmdError extends CR {
400
470
  type: "chatCmdError";
471
+ user_?: User;
401
472
  chatError: ChatError;
402
473
  }
403
474
  export interface CRChatError extends CR {
404
475
  type: "chatError";
476
+ user_?: User;
405
477
  chatError: ChatError;
406
478
  }
407
479
  export interface User {
408
480
  userId: number;
481
+ agentUserId: string;
409
482
  userContactId: number;
410
483
  localDisplayName: string;
411
- profile: Profile;
484
+ profile: LocalProfile;
412
485
  activeUser: boolean;
486
+ viewPwdHash: string;
487
+ showNtfs: boolean;
488
+ }
489
+ export interface UserProtoServers {
490
+ serverProtocol: ServerProtocol;
491
+ protoServers: ServerCfg[];
492
+ presetServers: string;
413
493
  }
414
494
  export interface Chat {
415
495
  chatInfo: ChatInfo;
416
496
  chatItems: [ChatItem];
417
497
  chatStats: ChatStats;
418
498
  }
419
- export declare type ChatInfo = CInfoDirect | CInfoGroup | CInfoContactRequest;
499
+ export type ChatInfo = CInfoDirect | CInfoGroup | CInfoContactRequest;
420
500
  export declare enum ChatInfoType {
421
501
  Direct = "direct",
422
502
  Group = "group",
@@ -437,6 +517,14 @@ interface CInfoContactRequest extends IChatInfo {
437
517
  type: ChatInfoType.ContactRequest;
438
518
  contactRequest: UserContactRequest;
439
519
  }
520
+ export interface UserPwdHash {
521
+ hash: string;
522
+ salt: string;
523
+ }
524
+ interface UserInfo {
525
+ user: User;
526
+ unreadCount: number;
527
+ }
440
528
  export interface Contact {
441
529
  contactId: number;
442
530
  localDisplayName: string;
@@ -494,7 +582,7 @@ export interface ChatItem {
494
582
  formattedText?: FormattedText[];
495
583
  quotedItem?: CIQuote;
496
584
  }
497
- export declare type CIDirection = CIDirectSnd | CIDirectRcv | CIGroupSnd | CIGroupRcv;
585
+ export type CIDirection = CIDirectSnd | CIDirectRcv | CIGroupSnd | CIGroupRcv;
498
586
  interface ICIDirection {
499
587
  type: "directSnd" | "directRcv" | "groupSnd" | "groupRcv";
500
588
  }
@@ -521,7 +609,7 @@ export interface CIMeta {
521
609
  itemEdited: boolean;
522
610
  editable: boolean;
523
611
  }
524
- export declare type CIContent = CISndMsgContent | CIRcvMsgContent | CISndDeleted | CIRcvDeleted | CISndFileInvitation | CIRcvFileInvitation;
612
+ export type CIContent = CISndMsgContent | CIRcvMsgContent | CISndDeleted | CIRcvDeleted | CISndFileInvitation | CIRcvFileInvitation;
525
613
  interface ICIContent {
526
614
  type: "sndMsgContent" | "rcvMsgContent" | "sndDeleted" | "rcvDeleted" | "sndFileInvitation" | "rcvFileInvitation";
527
615
  }
@@ -595,7 +683,7 @@ export interface CIQuote {
595
683
  content: MsgContent;
596
684
  formattedText?: FormattedText[];
597
685
  }
598
- export declare type CIStatus = CISndNew | CISndSent | CISndErrorAuth | CISndError | CIRcvNew | CIRcvRead;
686
+ export type CIStatus = CISndNew | CISndSent | CISndErrorAuth | CISndError | CIRcvNew | CIRcvRead;
599
687
  interface ICIStatus {
600
688
  type: "sndNew" | "sndSent" | "sndErrorAuth" | "sndError" | "rcvNew" | "rcvRead";
601
689
  }
@@ -622,7 +710,7 @@ interface FormattedText {
622
710
  }
623
711
  interface MsgErrorType {
624
712
  }
625
- export declare type ChatError = ChatErrorChat | ChatErrorAgent | ChatErrorStore;
713
+ export type ChatError = ChatErrorChat | ChatErrorAgent | ChatErrorStore;
626
714
  interface ChatErrorChat {
627
715
  type: "error";
628
716
  errorType: ChatErrorType;
@@ -635,7 +723,7 @@ interface ChatErrorStore {
635
723
  type: "errorStore";
636
724
  storeError: StoreErrorType;
637
725
  }
638
- declare type ChatErrorType = CENoActiveUser | CEActiveUserExists;
726
+ type ChatErrorType = CENoActiveUser | CEActiveUserExists;
639
727
  interface CENoActiveUser {
640
728
  type: "noActiveUser";
641
729
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":";;;AA+wBA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;IACf,iDAAiC,CAAA;AACnC,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AA4KD,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"}
@@ -11,7 +11,7 @@ export declare abstract class Transport<W, R> {
11
11
  read(): Promise<R>;
12
12
  next(): Promise<NextIter<R>>;
13
13
  }
14
- declare type WSData = Uint8Array | string;
14
+ type WSData = Uint8Array | string;
15
15
  export declare class WSTransport extends Transport<WSData, WSData> {
16
16
  private readonly sock;
17
17
  readonly timeout: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplex-chat",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "SimpleX Chat client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "^27.5.1",
39
- "@types/node": "^17.0.24",
39
+ "@types/node": "^18.11.18",
40
40
  "@typescript-eslint/eslint-plugin": "^5.23.0",
41
41
  "@typescript-eslint/parser": "^5.23.0",
42
42
  "eslint": "^8.15.0",
@@ -48,7 +48,7 @@
48
48
  "rollup": "^2.72.1",
49
49
  "ts-jest": "^28.0.2",
50
50
  "ts-node": "^10.7.0",
51
- "typescript": "^4.6.3"
51
+ "typescript": "^4.9.3"
52
52
  },
53
53
  "husky": {
54
54
  "hooks": {
@@ -1,8 +0,0 @@
1
- declare const Ws: {
2
- new (url: string | URL, protocols?: string | string[] | undefined): WebSocket;
3
- prototype: WebSocket;
4
- readonly CLOSED: number;
5
- readonly CLOSING: number;
6
- readonly CONNECTING: number;
7
- readonly OPEN: number;
8
- };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- const Ws = require("isomorphic-ws");
3
- Object.defineProperty(global, "WebSocket", { value: Ws });
4
- //# sourceMappingURL=browser_globals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser_globals.js","sourceRoot":"","sources":["../src/browser_globals.ts"],"names":[],"mappings":";AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAqB,CAAA;AAEvD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC,CAAC,CAAA"}