@imessaging/core 0.8.7 → 0.8.9
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/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/types.ts +24 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export {
|
|
|
18
18
|
canFindByPhone,
|
|
19
19
|
canSaveContact,
|
|
20
20
|
canMarkRead,
|
|
21
|
+
canObserveOutgoingRead,
|
|
21
22
|
canReact,
|
|
22
23
|
canReceive,
|
|
23
24
|
canObserveOutgoing,
|
|
@@ -35,6 +36,8 @@ export type {
|
|
|
35
36
|
IncomingLink,
|
|
36
37
|
IncomingMessage,
|
|
37
38
|
IncomingMessageTransport,
|
|
39
|
+
OutgoingReadReceipt,
|
|
40
|
+
OutgoingReadReceiptTransport,
|
|
38
41
|
ReadReceiptTransport,
|
|
39
42
|
TypingTransport,
|
|
40
43
|
} from "./types";
|
package/src/types.ts
CHANGED
|
@@ -305,6 +305,11 @@ export type IncomingMessage = {
|
|
|
305
305
|
* с другого устройства. Помечается, а не отбрасывается: иначе своя отправка выглядела бы правкой оператора.
|
|
306
306
|
*/
|
|
307
307
|
sentByTransport?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Сообщение отправила сама учётка — есть в истории (history, messagesByIds), где свои идут вперемешку
|
|
310
|
+
* с чужими; `undefined` — канал этого не сообщает.
|
|
311
|
+
*/
|
|
312
|
+
outgoing?: boolean;
|
|
308
313
|
/**
|
|
309
314
|
* Форматирование текста в той же модели, что исходящая разметка, смещения в UTF-16;
|
|
310
315
|
* undefined = канал не сообщает форматирование, [] = сообщил, форматирования нет.
|
|
@@ -503,3 +508,22 @@ export interface ReadReceiptTransport extends MessageTransport {
|
|
|
503
508
|
export function canMarkRead(transport: MessageTransport): transport is ReadReceiptTransport {
|
|
504
509
|
return typeof (transport as ReadReceiptTransport).markRead === "function";
|
|
505
510
|
}
|
|
511
|
+
|
|
512
|
+
/** Отметка о том, что адресат прочитал наши исходящие сообщения. */
|
|
513
|
+
export type OutgoingReadReceipt = {
|
|
514
|
+
chatId: string;
|
|
515
|
+
/** Включительно: все исходящие до этого номера прочтены. */
|
|
516
|
+
maxMessageId: string;
|
|
517
|
+
readAt: Date;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
/** Канал, умеющий сообщать о прочтении адресатом наших исходящих сообщений. */
|
|
521
|
+
export interface OutgoingReadReceiptTransport extends MessageTransport {
|
|
522
|
+
onOutgoingRead(handler: (receipt: OutgoingReadReceipt) => void | Promise<void>): () => void;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export function canObserveOutgoingRead(
|
|
526
|
+
transport: MessageTransport,
|
|
527
|
+
): transport is OutgoingReadReceiptTransport {
|
|
528
|
+
return typeof (transport as OutgoingReadReceiptTransport).onOutgoingRead === "function";
|
|
529
|
+
}
|