@imessaging/core 0.6.0 → 0.7.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imessaging/core",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Core messaging transport contracts and Telegram peer storage",
5
5
  "keywords": [
6
6
  "messaging",
package/src/index.ts CHANGED
@@ -23,6 +23,8 @@ export type {
23
23
  EditableMessageTransport,
24
24
  EditResult,
25
25
  EmailRecipient,
26
+ HeadhunterRecipient,
27
+ MaxRecipient,
26
28
  MessageRecipient,
27
29
  MessageTransport,
28
30
  OutboundButton,
package/src/types.ts CHANGED
@@ -25,7 +25,24 @@ export type EmailRecipient = {
25
25
  name?: string;
26
26
  };
27
27
 
28
- export type MessageRecipient = UsernameRecipient | TelegramIdRecipient | EmailRecipient;
28
+ /** Чат MAX. `chatId` выдаёт API MAX; это не номер телефона пользователя. */
29
+ export type MaxRecipient = {
30
+ type: "max";
31
+ chatId: string;
32
+ };
33
+
34
+ /** Диалог (отклик) HeadHunter, в который работодатель уже может написать. */
35
+ export type HeadhunterRecipient = {
36
+ type: "headhunter";
37
+ negotiationId: string;
38
+ };
39
+
40
+ export type MessageRecipient =
41
+ | UsernameRecipient
42
+ | TelegramIdRecipient
43
+ | EmailRecipient
44
+ | MaxRecipient
45
+ | HeadhunterRecipient;
29
46
 
30
47
  /** Получатель, адресуемый в Telegram. Сужение для транспортов, которые кроме него ничего не умеют. */
31
48
  export type TelegramRecipient = UsernameRecipient | TelegramIdRecipient;
@@ -37,7 +54,12 @@ export type TelegramRecipient = UsernameRecipient | TelegramIdRecipient;
37
54
  * по местам использования `recipient.id` и в каждом будет своей.
38
55
  */
39
56
  export function isTelegramRecipient(recipient: MessageRecipient): recipient is TelegramRecipient {
40
- return recipient.type !== "email";
57
+ return (
58
+ recipient.type === "username" ||
59
+ recipient.type === "user" ||
60
+ recipient.type === "group" ||
61
+ recipient.type === "channel"
62
+ );
41
63
  }
42
64
 
43
65
  export type OutboundDocument = {