core-services-sdk 1.3.47 → 1.3.49
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/instant-messages/message-types.js +26 -32
- package/src/instant-messages/message-unified-mapper.js +11 -3
- package/tests/instant-messages/message-unified-mapper-telegram.unit.test.js +0 -1
- package/tests/instant-messages/message-unified-mapper-whatsapp.unit.test.js +7 -2
- package/tests/instant-messages/unified-message-type.unit.test.js +78 -0
- package/types/instant-messages/message-types.d.ts +74 -26
- package/types/instant-messages/message-unified-mapper.d.ts +14 -14
package/package.json
CHANGED
|
@@ -7,54 +7,24 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @readonly
|
|
9
9
|
* @enum {string}
|
|
10
|
+
* @type {{ [key: string]: string }}
|
|
10
11
|
*
|
|
11
12
|
* @property {"text"} TEXT
|
|
12
|
-
* Represents plain text content.
|
|
13
|
-
*
|
|
14
13
|
* @property {"poll"} POLL
|
|
15
|
-
* Represents a Telegram poll (multiple-choice question).
|
|
16
|
-
*
|
|
17
14
|
* @property {"video"} VIDEO
|
|
18
|
-
* Represents a standard video file.
|
|
19
|
-
*
|
|
20
15
|
* @property {"photo"} PHOTO
|
|
21
|
-
* Represents a Telegram “photo” array (before mapping to IMAGE).
|
|
22
|
-
*
|
|
23
16
|
* @property {"image"} IMAGE
|
|
24
|
-
* Represents an image file (after normalization).
|
|
25
|
-
*
|
|
26
17
|
* @property {"voice"} VOICE
|
|
27
|
-
* Represents Telegram's "voice" messages (OGG encoded voice notes).
|
|
28
|
-
*
|
|
29
18
|
* @property {"audio"} AUDIO
|
|
30
|
-
* Represents general audio files (WhatsApp voice notes, audio uploads).
|
|
31
|
-
*
|
|
32
19
|
* @property {"sticker"} STICKER
|
|
33
|
-
* Represents sticker messages (Telegram or WhatsApp).
|
|
34
|
-
*
|
|
35
20
|
* @property {"contact"} CONTACT
|
|
36
|
-
* Represents a shared contact card.
|
|
37
|
-
*
|
|
38
21
|
* @property {"reaction"} REACTION
|
|
39
|
-
* Represents WhatsApp/Telegram reactions (emojis on messages).
|
|
40
|
-
*
|
|
41
22
|
* @property {"document"} DOCUMENT
|
|
42
|
-
* Represents generic uploaded files, including PDFs.
|
|
43
|
-
*
|
|
44
23
|
* @property {"location"} LOCATION
|
|
45
|
-
* Represents geographic coordinates.
|
|
46
|
-
*
|
|
47
24
|
* @property {"contacts"} CONTACTS
|
|
48
|
-
* Represents WhatsApp contacts array (before mapping to CONTACT).
|
|
49
|
-
*
|
|
50
25
|
* @property {"video_note"} VIDEO_NOTE
|
|
51
|
-
* Represents Telegram's circular "video note".
|
|
52
|
-
*
|
|
53
26
|
* @property {"button_click"} BUTTON_CLICK
|
|
54
|
-
* Represents a button press (interactive replies).
|
|
55
|
-
*
|
|
56
27
|
* @property {"button_click_multiple"} BUTTON_CLICK_MULTIPLE
|
|
57
|
-
* Represents list/menu selection (e.g., WhatsApp list_reply).
|
|
58
28
|
*/
|
|
59
29
|
export const MESSAGE_MEDIA_TYPE = {
|
|
60
30
|
TEXT: 'text',
|
|
@@ -75,7 +45,6 @@ export const MESSAGE_MEDIA_TYPE = {
|
|
|
75
45
|
BUTTON_CLICK: 'button_click',
|
|
76
46
|
BUTTON_CLICK_MULTIPLE: 'button_click_multiple',
|
|
77
47
|
}
|
|
78
|
-
|
|
79
48
|
/**
|
|
80
49
|
* Additional high-level message categories.
|
|
81
50
|
*
|
|
@@ -83,6 +52,7 @@ export const MESSAGE_MEDIA_TYPE = {
|
|
|
83
52
|
*
|
|
84
53
|
* @readonly
|
|
85
54
|
* @enum {string}
|
|
55
|
+
* @type {{ [key: string]: string }}
|
|
86
56
|
*
|
|
87
57
|
* @property {"message"} MESSAGE
|
|
88
58
|
* Regular message container (base type in some providers).
|
|
@@ -125,3 +95,27 @@ export const MESSAGE_MEDIA_TYPE_MAPPER = {
|
|
|
125
95
|
[MESSAGE_MEDIA_TYPE.PHOTO]: MESSAGE_MEDIA_TYPE.IMAGE,
|
|
126
96
|
[MESSAGE_MEDIA_TYPE.CONTACTS]: MESSAGE_MEDIA_TYPE.CONTACT,
|
|
127
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Unified message media types based on existing MESSAGE_MEDIA_TYPE and MESSAGE_TYPE.
|
|
101
|
+
*
|
|
102
|
+
* This enum flattens and merges all raw message media types
|
|
103
|
+
* into a single canonical type list.
|
|
104
|
+
*
|
|
105
|
+
* VOICE → AUDIO
|
|
106
|
+
* PHOTO → IMAGE
|
|
107
|
+
* CONTACTS → CONTACT
|
|
108
|
+
*
|
|
109
|
+
* @readonly
|
|
110
|
+
* @enum {string}
|
|
111
|
+
* @type {{ [key: string]: string }}
|
|
112
|
+
*/
|
|
113
|
+
export const UNIFIED_MESSAGE_MEDIA_TYPE = {
|
|
114
|
+
...MESSAGE_MEDIA_TYPE,
|
|
115
|
+
...MESSAGE_TYPE,
|
|
116
|
+
|
|
117
|
+
// Normalized equivalents
|
|
118
|
+
AUDIO: MESSAGE_MEDIA_TYPE.AUDIO,
|
|
119
|
+
IMAGE: MESSAGE_MEDIA_TYPE.IMAGE,
|
|
120
|
+
CONTACT: MESSAGE_MEDIA_TYPE.CONTACT,
|
|
121
|
+
}
|
|
@@ -124,8 +124,12 @@ export const mapMessageTelegram = ({ imMessage }) => {
|
|
|
124
124
|
message,
|
|
125
125
|
imMessage,
|
|
126
126
|
})
|
|
127
|
-
|
|
128
|
-
return
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
...messageBase,
|
|
130
|
+
...messageContent,
|
|
131
|
+
type: MESSAGE_MEDIA_TYPE_MAPPER[type] || type,
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
export const getWhatsAppMessageType = ({ message }) => {
|
|
@@ -238,7 +242,11 @@ export const mapMessageWhatsApp = ({ imMessage }) => {
|
|
|
238
242
|
context,
|
|
239
243
|
})
|
|
240
244
|
|
|
241
|
-
return {
|
|
245
|
+
return {
|
|
246
|
+
...messageBase,
|
|
247
|
+
...messageContent,
|
|
248
|
+
type: MESSAGE_MEDIA_TYPE_MAPPER[type] || type,
|
|
249
|
+
}
|
|
242
250
|
}
|
|
243
251
|
|
|
244
252
|
export const messageUnifiedMapper = {
|
|
@@ -39,7 +39,6 @@ describe('Telegram unified message mapper – all mock samples', () => {
|
|
|
39
39
|
|
|
40
40
|
expect(unifiedMessage).toBeTypeOf('object')
|
|
41
41
|
expect(unifiedType).toBeTypeOf('string')
|
|
42
|
-
|
|
43
42
|
expect(unifiedMessage.type).toBe(
|
|
44
43
|
MESSAGE_MEDIA_TYPE_MAPPER[unifiedType] || unifiedType,
|
|
45
44
|
)
|
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
mapMessageWhatsApp,
|
|
9
9
|
} from '../../src/instant-messages/message-unified-mapper.js'
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
MESSAGE_MEDIA_TYPE,
|
|
13
|
+
MESSAGE_MEDIA_TYPE_MAPPER,
|
|
14
|
+
} from '../../src/instant-messages/message-types.js'
|
|
12
15
|
const __filename = fileURLToPath(import.meta.url)
|
|
13
16
|
const __dirname = dirname(__filename)
|
|
14
17
|
|
|
@@ -40,7 +43,9 @@ describe('WhatsApp unified message mapper – all mock samples', () => {
|
|
|
40
43
|
expect(unifiedType).toBeTypeOf('string')
|
|
41
44
|
|
|
42
45
|
// Type must match mapper result
|
|
43
|
-
expect(unifiedMessage.type).toBe(
|
|
46
|
+
expect(unifiedMessage.type).toBe(
|
|
47
|
+
MESSAGE_MEDIA_TYPE_MAPPER[unifiedType] || unifiedType,
|
|
48
|
+
)
|
|
44
49
|
|
|
45
50
|
// All unified types must be supported values
|
|
46
51
|
expect(Object.values(MESSAGE_MEDIA_TYPE)).toContain(unifiedType)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
MESSAGE_TYPE,
|
|
4
|
+
MESSAGE_MEDIA_TYPE,
|
|
5
|
+
MESSAGE_MEDIA_TYPE_MAPPER,
|
|
6
|
+
UNIFIED_MESSAGE_MEDIA_TYPE,
|
|
7
|
+
} from '../../src/instant-messages/message-types.js'
|
|
8
|
+
|
|
9
|
+
describe('UNIFIED_MESSAGE_MEDIA_TYPE', () => {
|
|
10
|
+
it('should include all keys from MESSAGE_MEDIA_TYPE via spread', () => {
|
|
11
|
+
for (const key of Object.keys(MESSAGE_MEDIA_TYPE)) {
|
|
12
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE).toHaveProperty(key)
|
|
13
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE[key]).toBe(MESSAGE_MEDIA_TYPE[key])
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should include all keys from MESSAGE_TYPE via spread', () => {
|
|
18
|
+
for (const key of Object.keys(MESSAGE_TYPE)) {
|
|
19
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE).toHaveProperty(key)
|
|
20
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE[key]).toBe(MESSAGE_TYPE[key])
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('should include normalized AUDIO mapped from VOICE', () => {
|
|
25
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE.AUDIO).toBe(MESSAGE_MEDIA_TYPE.AUDIO)
|
|
26
|
+
expect(MESSAGE_MEDIA_TYPE_MAPPER[MESSAGE_MEDIA_TYPE.VOICE]).toBe(
|
|
27
|
+
MESSAGE_MEDIA_TYPE.AUDIO,
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('should include normalized IMAGE mapped from PHOTO', () => {
|
|
32
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE.IMAGE).toBe(MESSAGE_MEDIA_TYPE.IMAGE)
|
|
33
|
+
expect(MESSAGE_MEDIA_TYPE_MAPPER[MESSAGE_MEDIA_TYPE.PHOTO]).toBe(
|
|
34
|
+
MESSAGE_MEDIA_TYPE.IMAGE,
|
|
35
|
+
)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('should include normalized CONTACT mapped from CONTACTS', () => {
|
|
39
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE.CONTACT).toBe(MESSAGE_MEDIA_TYPE.CONTACT)
|
|
40
|
+
expect(MESSAGE_MEDIA_TYPE_MAPPER[MESSAGE_MEDIA_TYPE.CONTACTS]).toBe(
|
|
41
|
+
MESSAGE_MEDIA_TYPE.CONTACT,
|
|
42
|
+
)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('should define UNKNOWN correctly', () => {
|
|
46
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE.UNKNOWN_MESSAGE_TYPE).toBe(
|
|
47
|
+
MESSAGE_TYPE.UNKNOWN_MESSAGE_TYPE,
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('should not contain unexpected duplicates', () => {
|
|
52
|
+
const values = Object.values(UNIFIED_MESSAGE_MEDIA_TYPE)
|
|
53
|
+
const uniqueValues = new Set(values)
|
|
54
|
+
expect(values.length).toBe(uniqueValues.size)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('should contain required high-level unified types', () => {
|
|
58
|
+
const required = [
|
|
59
|
+
'TEXT',
|
|
60
|
+
'IMAGE',
|
|
61
|
+
'AUDIO',
|
|
62
|
+
'VIDEO',
|
|
63
|
+
'DOCUMENT',
|
|
64
|
+
'STICKER',
|
|
65
|
+
'CONTACT',
|
|
66
|
+
'LOCATION',
|
|
67
|
+
'POLL',
|
|
68
|
+
'VIDEO_NOTE',
|
|
69
|
+
'BUTTON_CLICK',
|
|
70
|
+
'BUTTON_CLICK_MULTIPLE',
|
|
71
|
+
'REACTION',
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
for (const key of required) {
|
|
75
|
+
expect(UNIFIED_MESSAGE_MEDIA_TYPE).toHaveProperty(key)
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -2,37 +2,64 @@
|
|
|
2
2
|
* *
|
|
3
3
|
*/
|
|
4
4
|
export type MESSAGE_MEDIA_TYPE = string
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Enumerates all supported incoming media/content types
|
|
7
|
+
* across messaging platforms (Telegram, WhatsApp, etc).
|
|
8
|
+
*
|
|
9
|
+
* This is the unified taxonomy used inside the system
|
|
10
|
+
* after normalization of the raw message payload.
|
|
11
|
+
*
|
|
12
|
+
* @readonly
|
|
13
|
+
* @enum {string}
|
|
14
|
+
* @type {{ [key: string]: string }}
|
|
15
|
+
*
|
|
16
|
+
* @property {"text"} TEXT
|
|
17
|
+
* @property {"poll"} POLL
|
|
18
|
+
* @property {"video"} VIDEO
|
|
19
|
+
* @property {"photo"} PHOTO
|
|
20
|
+
* @property {"image"} IMAGE
|
|
21
|
+
* @property {"voice"} VOICE
|
|
22
|
+
* @property {"audio"} AUDIO
|
|
23
|
+
* @property {"sticker"} STICKER
|
|
24
|
+
* @property {"contact"} CONTACT
|
|
25
|
+
* @property {"reaction"} REACTION
|
|
26
|
+
* @property {"document"} DOCUMENT
|
|
27
|
+
* @property {"location"} LOCATION
|
|
28
|
+
* @property {"contacts"} CONTACTS
|
|
29
|
+
* @property {"video_note"} VIDEO_NOTE
|
|
30
|
+
* @property {"button_click"} BUTTON_CLICK
|
|
31
|
+
* @property {"button_click_multiple"} BUTTON_CLICK_MULTIPLE
|
|
32
|
+
*/
|
|
33
|
+
export const MESSAGE_MEDIA_TYPE: {
|
|
34
|
+
[key: string]: string
|
|
23
35
|
}
|
|
24
36
|
/**
|
|
25
37
|
* *
|
|
26
38
|
*/
|
|
27
39
|
export type MESSAGE_TYPE = string
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Additional high-level message categories.
|
|
42
|
+
*
|
|
43
|
+
* These represent logical groupings rather than raw media types.
|
|
44
|
+
*
|
|
45
|
+
* @readonly
|
|
46
|
+
* @enum {string}
|
|
47
|
+
* @type {{ [key: string]: string }}
|
|
48
|
+
*
|
|
49
|
+
* @property {"message"} MESSAGE
|
|
50
|
+
* Regular message container (base type in some providers).
|
|
51
|
+
*
|
|
52
|
+
* @property {"button_click"} BUTTON_CLICK
|
|
53
|
+
* A click on a single interactive button.
|
|
54
|
+
*
|
|
55
|
+
* @property {"button_click_multiple"} BUTTON_CLICK_MULTIPLE
|
|
56
|
+
* A selection from a list of interactive reply choices.
|
|
57
|
+
*
|
|
58
|
+
* @property {"unknown_message_type"} UNKNOWN_MESSAGE_TYPE
|
|
59
|
+
* Used when the system cannot identify or normalize the message type.
|
|
60
|
+
*/
|
|
61
|
+
export const MESSAGE_TYPE: {
|
|
62
|
+
[key: string]: string
|
|
36
63
|
}
|
|
37
64
|
/**
|
|
38
65
|
* *
|
|
@@ -60,3 +87,24 @@ export const MESSAGE_MEDIA_TYPE_MAPPER: {
|
|
|
60
87
|
[MESSAGE_MEDIA_TYPE.PHOTO]: string
|
|
61
88
|
[MESSAGE_MEDIA_TYPE.CONTACTS]: string
|
|
62
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* *
|
|
92
|
+
*/
|
|
93
|
+
export type UNIFIED_MESSAGE_MEDIA_TYPE = string
|
|
94
|
+
/**
|
|
95
|
+
* Unified message media types based on existing MESSAGE_MEDIA_TYPE and MESSAGE_TYPE.
|
|
96
|
+
*
|
|
97
|
+
* This enum flattens and merges all raw message media types
|
|
98
|
+
* into a single canonical type list.
|
|
99
|
+
*
|
|
100
|
+
* VOICE → AUDIO
|
|
101
|
+
* PHOTO → IMAGE
|
|
102
|
+
* CONTACTS → CONTACT
|
|
103
|
+
*
|
|
104
|
+
* @readonly
|
|
105
|
+
* @enum {string}
|
|
106
|
+
* @type {{ [key: string]: string }}
|
|
107
|
+
*/
|
|
108
|
+
export const UNIFIED_MESSAGE_MEDIA_TYPE: {
|
|
109
|
+
[key: string]: string
|
|
110
|
+
}
|
|
@@ -40,6 +40,7 @@ export function mapMessageWhatsAppContent({
|
|
|
40
40
|
}
|
|
41
41
|
export function mapMessageTelegram({ imMessage }: { imMessage: any }):
|
|
42
42
|
| {
|
|
43
|
+
type: string
|
|
43
44
|
text: any
|
|
44
45
|
reply?: undefined
|
|
45
46
|
timestamp: string
|
|
@@ -52,11 +53,11 @@ export function mapMessageTelegram({ imMessage }: { imMessage: any }):
|
|
|
52
53
|
tmId: any
|
|
53
54
|
}
|
|
54
55
|
chatId: any
|
|
55
|
-
type: string
|
|
56
56
|
chatter: any
|
|
57
57
|
itIsForward: boolean
|
|
58
58
|
}
|
|
59
59
|
| {
|
|
60
|
+
type: string
|
|
60
61
|
text?: undefined
|
|
61
62
|
reply?: undefined
|
|
62
63
|
timestamp: string
|
|
@@ -69,11 +70,11 @@ export function mapMessageTelegram({ imMessage }: { imMessage: any }):
|
|
|
69
70
|
tmId: any
|
|
70
71
|
}
|
|
71
72
|
chatId: any
|
|
72
|
-
type: string
|
|
73
73
|
chatter: any
|
|
74
74
|
itIsForward: boolean
|
|
75
75
|
}
|
|
76
76
|
| {
|
|
77
|
+
type: string
|
|
77
78
|
attachment: string
|
|
78
79
|
animation: any
|
|
79
80
|
text?: undefined
|
|
@@ -88,11 +89,11 @@ export function mapMessageTelegram({ imMessage }: { imMessage: any }):
|
|
|
88
89
|
tmId: any
|
|
89
90
|
}
|
|
90
91
|
chatId: any
|
|
91
|
-
type: string
|
|
92
92
|
chatter: any
|
|
93
93
|
itIsForward: boolean
|
|
94
94
|
}
|
|
95
95
|
| {
|
|
96
|
+
type: string
|
|
96
97
|
reply: {
|
|
97
98
|
id: any
|
|
98
99
|
title: any
|
|
@@ -108,7 +109,6 @@ export function mapMessageTelegram({ imMessage }: { imMessage: any }):
|
|
|
108
109
|
tmId: any
|
|
109
110
|
}
|
|
110
111
|
chatId: any
|
|
111
|
-
type: string
|
|
112
112
|
chatter: any
|
|
113
113
|
itIsForward: boolean
|
|
114
114
|
}
|
|
@@ -175,6 +175,7 @@ export function mapMessageTelegramContent({
|
|
|
175
175
|
}
|
|
176
176
|
export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
177
177
|
| {
|
|
178
|
+
type: any
|
|
178
179
|
text: any
|
|
179
180
|
reply?: undefined
|
|
180
181
|
id: any
|
|
@@ -182,7 +183,6 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
182
183
|
imExtraInfo: {
|
|
183
184
|
wbaid: any
|
|
184
185
|
}
|
|
185
|
-
type: any
|
|
186
186
|
chatter: {
|
|
187
187
|
id: any
|
|
188
188
|
name: any
|
|
@@ -192,6 +192,7 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
192
192
|
timestamp: any
|
|
193
193
|
}
|
|
194
194
|
| {
|
|
195
|
+
type: any
|
|
195
196
|
text?: undefined
|
|
196
197
|
reply?: undefined
|
|
197
198
|
id: any
|
|
@@ -199,7 +200,6 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
199
200
|
imExtraInfo: {
|
|
200
201
|
wbaid: any
|
|
201
202
|
}
|
|
202
|
-
type: any
|
|
203
203
|
chatter: {
|
|
204
204
|
id: any
|
|
205
205
|
name: any
|
|
@@ -209,6 +209,7 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
209
209
|
timestamp: any
|
|
210
210
|
}
|
|
211
211
|
| {
|
|
212
|
+
type: any
|
|
212
213
|
reply: any
|
|
213
214
|
text?: undefined
|
|
214
215
|
id: any
|
|
@@ -216,7 +217,6 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
216
217
|
imExtraInfo: {
|
|
217
218
|
wbaid: any
|
|
218
219
|
}
|
|
219
|
-
type: any
|
|
220
220
|
chatter: {
|
|
221
221
|
id: any
|
|
222
222
|
name: any
|
|
@@ -228,6 +228,7 @@ export function mapMessageWhatsApp({ imMessage }: { imMessage: any }):
|
|
|
228
228
|
export const messageUnifiedMapper: {
|
|
229
229
|
[IM_PLATFORM.TELEGRAM]: ({ imMessage }: { imMessage: any }) =>
|
|
230
230
|
| {
|
|
231
|
+
type: string
|
|
231
232
|
text: any
|
|
232
233
|
reply?: undefined
|
|
233
234
|
timestamp: string
|
|
@@ -240,11 +241,11 @@ export const messageUnifiedMapper: {
|
|
|
240
241
|
tmId: any
|
|
241
242
|
}
|
|
242
243
|
chatId: any
|
|
243
|
-
type: string
|
|
244
244
|
chatter: any
|
|
245
245
|
itIsForward: boolean
|
|
246
246
|
}
|
|
247
247
|
| {
|
|
248
|
+
type: string
|
|
248
249
|
text?: undefined
|
|
249
250
|
reply?: undefined
|
|
250
251
|
timestamp: string
|
|
@@ -257,11 +258,11 @@ export const messageUnifiedMapper: {
|
|
|
257
258
|
tmId: any
|
|
258
259
|
}
|
|
259
260
|
chatId: any
|
|
260
|
-
type: string
|
|
261
261
|
chatter: any
|
|
262
262
|
itIsForward: boolean
|
|
263
263
|
}
|
|
264
264
|
| {
|
|
265
|
+
type: string
|
|
265
266
|
attachment: string
|
|
266
267
|
animation: any
|
|
267
268
|
text?: undefined
|
|
@@ -276,11 +277,11 @@ export const messageUnifiedMapper: {
|
|
|
276
277
|
tmId: any
|
|
277
278
|
}
|
|
278
279
|
chatId: any
|
|
279
|
-
type: string
|
|
280
280
|
chatter: any
|
|
281
281
|
itIsForward: boolean
|
|
282
282
|
}
|
|
283
283
|
| {
|
|
284
|
+
type: string
|
|
284
285
|
reply: {
|
|
285
286
|
id: any
|
|
286
287
|
title: any
|
|
@@ -296,12 +297,12 @@ export const messageUnifiedMapper: {
|
|
|
296
297
|
tmId: any
|
|
297
298
|
}
|
|
298
299
|
chatId: any
|
|
299
|
-
type: string
|
|
300
300
|
chatter: any
|
|
301
301
|
itIsForward: boolean
|
|
302
302
|
}
|
|
303
303
|
[IM_PLATFORM.WHATSAPP]: ({ imMessage }: { imMessage: any }) =>
|
|
304
304
|
| {
|
|
305
|
+
type: any
|
|
305
306
|
text: any
|
|
306
307
|
reply?: undefined
|
|
307
308
|
id: any
|
|
@@ -309,7 +310,6 @@ export const messageUnifiedMapper: {
|
|
|
309
310
|
imExtraInfo: {
|
|
310
311
|
wbaid: any
|
|
311
312
|
}
|
|
312
|
-
type: any
|
|
313
313
|
chatter: {
|
|
314
314
|
id: any
|
|
315
315
|
name: any
|
|
@@ -319,6 +319,7 @@ export const messageUnifiedMapper: {
|
|
|
319
319
|
timestamp: any
|
|
320
320
|
}
|
|
321
321
|
| {
|
|
322
|
+
type: any
|
|
322
323
|
text?: undefined
|
|
323
324
|
reply?: undefined
|
|
324
325
|
id: any
|
|
@@ -326,7 +327,6 @@ export const messageUnifiedMapper: {
|
|
|
326
327
|
imExtraInfo: {
|
|
327
328
|
wbaid: any
|
|
328
329
|
}
|
|
329
|
-
type: any
|
|
330
330
|
chatter: {
|
|
331
331
|
id: any
|
|
332
332
|
name: any
|
|
@@ -336,6 +336,7 @@ export const messageUnifiedMapper: {
|
|
|
336
336
|
timestamp: any
|
|
337
337
|
}
|
|
338
338
|
| {
|
|
339
|
+
type: any
|
|
339
340
|
reply: any
|
|
340
341
|
text?: undefined
|
|
341
342
|
id: any
|
|
@@ -343,7 +344,6 @@ export const messageUnifiedMapper: {
|
|
|
343
344
|
imExtraInfo: {
|
|
344
345
|
wbaid: any
|
|
345
346
|
}
|
|
346
|
-
type: any
|
|
347
347
|
chatter: {
|
|
348
348
|
id: any
|
|
349
349
|
name: any
|