@photon-ai/advanced-imessage-kit 1.0.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +497 -0
  3. package/dist/events.d.ts +32 -0
  4. package/dist/events.d.ts.map +1 -0
  5. package/dist/events.js +32 -0
  6. package/dist/events.js.map +1 -0
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +6 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/interfaces/index.d.ts +4 -0
  12. package/dist/interfaces/index.d.ts.map +1 -0
  13. package/dist/interfaces/index.js +2 -0
  14. package/dist/interfaces/index.js.map +1 -0
  15. package/dist/lib/Loggable.d.ts +16 -0
  16. package/dist/lib/Loggable.d.ts.map +1 -0
  17. package/dist/lib/Loggable.js +34 -0
  18. package/dist/lib/Loggable.js.map +1 -0
  19. package/dist/lib/Logger.d.ts +18 -0
  20. package/dist/lib/Logger.d.ts.map +1 -0
  21. package/dist/lib/Logger.js +77 -0
  22. package/dist/lib/Logger.js.map +1 -0
  23. package/dist/mobai.d.ts +38 -0
  24. package/dist/mobai.d.ts.map +1 -0
  25. package/dist/mobai.js +150 -0
  26. package/dist/mobai.js.map +1 -0
  27. package/dist/modules/attachment.d.ts +26 -0
  28. package/dist/modules/attachment.d.ts.map +1 -0
  29. package/dist/modules/attachment.js +87 -0
  30. package/dist/modules/attachment.js.map +1 -0
  31. package/dist/modules/chat.d.ts +49 -0
  32. package/dist/modules/chat.d.ts.map +1 -0
  33. package/dist/modules/chat.js +100 -0
  34. package/dist/modules/chat.js.map +1 -0
  35. package/dist/modules/contact.d.ts +10 -0
  36. package/dist/modules/contact.d.ts.map +1 -0
  37. package/dist/modules/contact.js +23 -0
  38. package/dist/modules/contact.js.map +1 -0
  39. package/dist/modules/facetime.d.ts +7 -0
  40. package/dist/modules/facetime.d.ts.map +1 -0
  41. package/dist/modules/facetime.js +10 -0
  42. package/dist/modules/facetime.js.map +1 -0
  43. package/dist/modules/handle.d.ts +24 -0
  44. package/dist/modules/handle.d.ts.map +1 -0
  45. package/dist/modules/handle.js +40 -0
  46. package/dist/modules/handle.js.map +1 -0
  47. package/dist/modules/icloud.d.ts +10 -0
  48. package/dist/modules/icloud.d.ts.map +1 -0
  49. package/dist/modules/icloud.js +20 -0
  50. package/dist/modules/icloud.js.map +1 -0
  51. package/dist/modules/index.d.ts +10 -0
  52. package/dist/modules/index.d.ts.map +1 -0
  53. package/dist/modules/index.js +10 -0
  54. package/dist/modules/index.js.map +1 -0
  55. package/dist/modules/message.d.ts +52 -0
  56. package/dist/modules/message.d.ts.map +1 -0
  57. package/dist/modules/message.js +104 -0
  58. package/dist/modules/message.js.map +1 -0
  59. package/dist/modules/scheduled.d.ts +10 -0
  60. package/dist/modules/scheduled.d.ts.map +1 -0
  61. package/dist/modules/scheduled.js +21 -0
  62. package/dist/modules/scheduled.js.map +1 -0
  63. package/dist/modules/server.d.ts +17 -0
  64. package/dist/modules/server.d.ts.map +1 -0
  65. package/dist/modules/server.js +46 -0
  66. package/dist/modules/server.js.map +1 -0
  67. package/dist/types/attachment.d.ts +36 -0
  68. package/dist/types/attachment.d.ts.map +1 -0
  69. package/dist/types/attachment.js +2 -0
  70. package/dist/types/attachment.js.map +1 -0
  71. package/dist/types/chat.d.ts +25 -0
  72. package/dist/types/chat.d.ts.map +1 -0
  73. package/dist/types/chat.js +2 -0
  74. package/dist/types/chat.js.map +1 -0
  75. package/dist/types/client.d.ts +5 -0
  76. package/dist/types/client.d.ts.map +1 -0
  77. package/dist/types/client.js +2 -0
  78. package/dist/types/client.js.map +1 -0
  79. package/dist/types/handle.d.ts +16 -0
  80. package/dist/types/handle.d.ts.map +1 -0
  81. package/dist/types/handle.js +2 -0
  82. package/dist/types/handle.js.map +1 -0
  83. package/dist/types/index.d.ts +9 -0
  84. package/dist/types/index.d.ts.map +1 -0
  85. package/dist/types/index.js +9 -0
  86. package/dist/types/index.js.map +1 -0
  87. package/dist/types/message.d.ts +100 -0
  88. package/dist/types/message.d.ts.map +1 -0
  89. package/dist/types/message.js +2 -0
  90. package/dist/types/message.js.map +1 -0
  91. package/dist/types/server.d.ts +14 -0
  92. package/dist/types/server.d.ts.map +1 -0
  93. package/dist/types/server.js +2 -0
  94. package/dist/types/server.js.map +1 -0
  95. package/dist/types/sticker.d.ts +7 -0
  96. package/dist/types/sticker.d.ts.map +1 -0
  97. package/dist/types/sticker.js +2 -0
  98. package/dist/types/sticker.js.map +1 -0
  99. package/dist/types/tapback.d.ts +3 -0
  100. package/dist/types/tapback.d.ts.map +1 -0
  101. package/dist/types/tapback.js +2 -0
  102. package/dist/types/tapback.js.map +1 -0
  103. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Photon AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,497 @@
1
+ <div align="center">
2
+
3
+ ![Banner](./.github/assets/banner.png)
4
+
5
+ # Advanced iMessage Kit
6
+
7
+ > Powerful TypeScript iMessage SDK with real-time message processing
8
+
9
+ </div>
10
+
11
+ [![TypeScript](https://img.shields.io/badge/TypeScript-^5-blue.svg)](https://www.typescriptlang.org/)
12
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
13
+
14
+ Advanced iMessage Kit is a comprehensive iMessage SDK for **reading**, **sending**, and **automating** iMessage conversations on macOS. Designed for building **AI agents**, **automation tools**, and **chat applications**.
15
+
16
+ ## Features
17
+
18
+ - **🔒 Type Safe** - Complete TypeScript support with full type definitions
19
+ - **⚡ Real-time Communication** - WebSocket-based event system for instant message updates
20
+ - **📱 Complete API** - Send text, attachments, reactions, edit messages, and more
21
+ - **👥 Group Management** - Create groups, manage members, set group icons
22
+ - **📎 Rich Attachments** - Send images, files, stickers, and contact cards
23
+ - **🔍 Advanced Querying** - Powerful message filtering and search capabilities
24
+ - **📊 Analytics** - Message counts, delivery status, and chat statistics
25
+ - **🎯 Event-driven** - Listen for new messages, typing indicators, and status changes
26
+
27
+ ## Quick Start
28
+
29
+ ### Installation
30
+
31
+ ```bash
32
+ npm install @photon-ai/advanced-imessage-kit
33
+ # or
34
+ bun add @photon-ai/advanced-imessage-kit
35
+ ```
36
+
37
+ ### Basic Usage
38
+
39
+ ```typescript
40
+ import { AdvancedIMessageKit } from '@photon-ai/advanced-imessage-kit'
41
+
42
+ const sdk = new AdvancedIMessageKit({
43
+ serverUrl: '{your-subdomain}.imsgd.photon.codes' // Your subdomain is the unique link address assigned to you
44
+ })
45
+
46
+ // Connect to the server
47
+ await sdk.connect()
48
+
49
+ // Listen for new messages
50
+ sdk.on('new-message', (message) => {
51
+ console.log('New message:', message.text)
52
+ })
53
+
54
+ // Send a message
55
+ await sdk.messages.sendMessage({
56
+ chatGuid: 'any;-;+1234567890',
57
+ message: 'Hello World!'
58
+ })
59
+
60
+ // Disconnect when done
61
+ await sdk.disconnect()
62
+ ```
63
+
64
+ ## Core API
65
+
66
+ ### Initialization & Connection
67
+
68
+ ```typescript
69
+ import { AdvancedIMessageKit } from '@photon-ai/advanced-imessage-kit'
70
+
71
+ const sdk = new AdvancedIMessageKit({
72
+ serverUrl: '{your-subdomain}.imsgd.photon.codes', // Your subdomain is the unique link address assigned to you
73
+ logLevel: 'info' // Log level: 'debug' | 'info' | 'warn' | 'error'
74
+ })
75
+
76
+ // Connect to server
77
+ await sdk.connect()
78
+
79
+ // Check connection status
80
+ sdk.on('ready', () => {
81
+ console.log('SDK is ready!')
82
+ })
83
+
84
+ // Graceful disconnect
85
+ await sdk.disconnect()
86
+ ```
87
+
88
+ ### Connection Management
89
+
90
+ ```typescript
91
+ // Message deduplication (prevents duplicate processing)
92
+ sdk.clearProcessedMessages(1000) // Clear old processed message records
93
+ const count = sdk.getProcessedMessageCount() // Get processed message count
94
+ ```
95
+
96
+ ## Message Operations
97
+
98
+ ### Sending Messages
99
+
100
+ ```typescript
101
+ // Send text message
102
+ const message = await sdk.messages.sendMessage({
103
+ chatGuid: 'any;-;+1234567890',
104
+ message: 'Hello World!'
105
+ })
106
+
107
+ // Send message with options
108
+ await sdk.messages.sendMessage({
109
+ chatGuid: 'any;-;+1234567890',
110
+ message: 'Important message',
111
+ subject: 'Subject line',
112
+ effectId: 'com.apple.messages.effect.CKConfettiEffect'
113
+ })
114
+
115
+ // Reply to message
116
+ await sdk.messages.sendMessage({
117
+ chatGuid: 'any;-;+1234567890',
118
+ message: 'This is a reply',
119
+ selectedMessageGuid: 'original-message-guid'
120
+ })
121
+ ```
122
+
123
+ ### Message Querying
124
+
125
+ ```typescript
126
+ // Get messages with filters
127
+ const messages = await sdk.messages.getMessages({
128
+ chatGuid: 'any;-;+1234567890',
129
+ limit: 50,
130
+ offset: 0
131
+ })
132
+
133
+ // Get message counts
134
+ const totalCount = await sdk.messages.getMessageCount({
135
+ chatGuid: 'any;-;+1234567890',
136
+ after: 1640995200000, // Timestamp
137
+ before: 1641081600000 // Timestamp
138
+ })
139
+
140
+ const sentCount = await sdk.messages.getSentMessageCount()
141
+ ```
142
+
143
+ ### Message Actions
144
+
145
+ ```typescript
146
+ // Edit message
147
+ await sdk.messages.editMessage({
148
+ messageGuid: 'message-guid',
149
+ editedMessage: 'Updated text',
150
+ backwardsCompatibilityMessage: 'Updated text'
151
+ })
152
+
153
+ // Add reaction
154
+ await sdk.messages.sendReaction({
155
+ chatGuid: 'any;-;+1234567890',
156
+ messageGuid: 'message-guid',
157
+ reaction: 'love', // Options: love, like, dislike, laugh, emphasize, question, -love, -like, etc.
158
+ partIndex: 0 // Optional: defaults to 0
159
+ })
160
+
161
+ // Unsend message
162
+ await sdk.messages.unsendMessage({
163
+ messageGuid: 'message-guid'
164
+ })
165
+ ```
166
+
167
+ ## Chat Management
168
+
169
+ ### Chat Operations
170
+
171
+ ```typescript
172
+ // Get all chats
173
+ const chats = await sdk.chats.getChats()
174
+
175
+ // Get specific chat
176
+ const chat = await sdk.chats.getChat('chat-guid', {
177
+ with: ['participants', 'lastMessage']
178
+ })
179
+
180
+ // Create new chat
181
+ const newChat = await sdk.chats.createChat({
182
+ addresses: ['+1234567890', '+0987654321'],
183
+ message: 'Hello everyone!',
184
+ service: 'iMessage', // 'iMessage' or 'SMS'
185
+ method: 'private-api' // 'apple-script' or 'private-api'
186
+ })
187
+ ```
188
+
189
+ ### Group Management
190
+
191
+ ```typescript
192
+ // Update group name
193
+ await sdk.chats.updateChat('chat-guid', {
194
+ displayName: 'My Group Chat'
195
+ })
196
+
197
+ // Add participant
198
+ await sdk.chats.addParticipant('chat-guid', '+1234567890')
199
+
200
+ // Remove participant
201
+ await sdk.chats.removeParticipant('chat-guid', '+1234567890')
202
+
203
+ // Leave group
204
+ await sdk.chats.leaveChat('chat-guid')
205
+ ```
206
+
207
+ ### Group Icons
208
+
209
+ ```typescript
210
+ // Set group icon
211
+ await sdk.chats.setGroupIcon('chat-guid', '/path/to/image.jpg')
212
+
213
+ // Get group icon
214
+ const iconBuffer = await sdk.chats.getGroupIcon('chat-guid')
215
+
216
+ // Remove group icon
217
+ await sdk.chats.removeGroupIcon('chat-guid')
218
+ ```
219
+
220
+ ### Chat Status
221
+
222
+ ```typescript
223
+ // Mark as read/unread
224
+ await sdk.chats.markChatRead('chat-guid')
225
+ await sdk.chats.markChatUnread('chat-guid')
226
+
227
+ // Typing indicators
228
+ await sdk.chats.startTyping('chat-guid')
229
+ await sdk.chats.stopTyping('chat-guid')
230
+
231
+ // Get chat messages
232
+ const messages = await sdk.chats.getChatMessages('chat-guid', {
233
+ limit: 100,
234
+ offset: 0,
235
+ sort: 'DESC'
236
+ })
237
+ ```
238
+
239
+ ## Attachments & Media
240
+
241
+ ### Sending Attachments
242
+
243
+ ```typescript
244
+ // Send file attachment
245
+ const message = await sdk.attachments.sendAttachment({
246
+ chatGuid: 'any;-;+1234567890',
247
+ filePath: '/path/to/file.jpg',
248
+ fileName: 'custom-name.jpg' // Optional
249
+ })
250
+
251
+ // Send sticker
252
+ await sdk.attachments.sendSticker({
253
+ chatGuid: 'any;-;+1234567890',
254
+ filePath: '/path/to/sticker.png',
255
+ selectedMessageGuid: 'message-to-reply-to' // Optional
256
+ })
257
+ ```
258
+
259
+ ### Attachment Info
260
+
261
+ ```typescript
262
+ // Get attachment details
263
+ const attachment = await sdk.attachments.getAttachment('attachment-guid')
264
+
265
+ // Get attachment count
266
+ const count = await sdk.attachments.getAttachmentCount()
267
+ ```
268
+
269
+ ## Contacts & Handles
270
+
271
+ ### Contact Management
272
+
273
+ ```typescript
274
+ // Get all contacts
275
+ const contacts = await sdk.contacts.getContacts()
276
+
277
+ // Get contact card
278
+ const contactCard = await sdk.contacts.getContactCard('+1234567890')
279
+
280
+ // Share contact card
281
+ await sdk.contacts.shareContactCard('chat-guid')
282
+
283
+ // Check if should share contact
284
+ const shouldShare = await sdk.contacts.shouldShareContact('chat-guid')
285
+ ```
286
+
287
+ ### Handle Operations
288
+
289
+ ```typescript
290
+ // Query handles
291
+ const result = await sdk.handles.queryHandles({
292
+ address: '+1234567890',
293
+ with: ['chats'],
294
+ limit: 50
295
+ })
296
+
297
+ // Get handle availability
298
+ const isAvailable = await sdk.handles.getHandleAvailability('handle-guid', 'imessage')
299
+
300
+ // Get focus status
301
+ const focusStatus = await sdk.handles.getHandleFocusStatus('handle-guid')
302
+ ```
303
+
304
+ ## Real-time Events
305
+
306
+ ```typescript
307
+ // Message events
308
+ sdk.on('new-message', (message) => {
309
+ console.log('New message received:', message.text)
310
+ })
311
+
312
+ sdk.on('updated-message', (message) => {
313
+ console.log('Message updated:', message.guid)
314
+ })
315
+
316
+ // Typing indicators
317
+ sdk.on('typing-indicator', (data) => {
318
+ console.log('Typing status changed:', data)
319
+ })
320
+
321
+ // Connection events
322
+ sdk.on('ready', () => {
323
+ console.log('SDK connected and ready')
324
+ })
325
+
326
+ sdk.on('error', (error) => {
327
+ console.error('SDK error:', error)
328
+ })
329
+
330
+ // Remove event listeners
331
+ sdk.off('new-message', messageHandler)
332
+ ```
333
+
334
+ ## Advanced Features
335
+
336
+ ### FaceTime Integration
337
+
338
+ ```typescript
339
+ // Create FaceTime link
340
+ const link = await sdk.facetime.createFaceTimeLink()
341
+ console.log('FaceTime link:', link)
342
+
343
+ // Listen for FaceTime status changes
344
+ sdk.on('facetime-status-change', (data) => {
345
+ console.log('FaceTime status:', data.status)
346
+ })
347
+ ```
348
+
349
+ ### iCloud Services
350
+
351
+ ```typescript
352
+ // Get Find My Friends
353
+ const friends = await sdk.icloud.getFindMyFriends()
354
+
355
+ // Get Find My Devices
356
+ const devices = await sdk.icloud.getFindMyDevices()
357
+
358
+ // Refresh data
359
+ await sdk.icloud.refreshFindMyFriends()
360
+ await sdk.icloud.refreshFindMyDevices()
361
+ ```
362
+
363
+ ### Scheduled Messages
364
+
365
+ ```typescript
366
+ // Create scheduled message
367
+ const scheduled = await sdk.scheduledMessages.createScheduledMessage({
368
+ chatGuid: 'any;-;+1234567890',
369
+ message: 'This message was scheduled!',
370
+ scheduledFor: new Date(Date.now() + 60000), // 1 minute from now
371
+ schedule: { type: 'once' }
372
+ })
373
+
374
+ // Get all scheduled messages
375
+ const allScheduled = await sdk.scheduledMessages.getScheduledMessages()
376
+
377
+ // Update scheduled message
378
+ await sdk.scheduledMessages.updateScheduledMessage('schedule-id', {
379
+ message: 'Updated message'
380
+ })
381
+
382
+ // Delete scheduled message
383
+ await sdk.scheduledMessages.deleteScheduledMessage('schedule-id')
384
+ ```
385
+
386
+ ### Server Information
387
+
388
+ ```typescript
389
+ // Get server info
390
+ const serverInfo = await sdk.server.getServerInfo()
391
+
392
+ // Get message statistics
393
+ const stats = await sdk.server.getMessageStats()
394
+
395
+ // Get server logs
396
+ const logs = await sdk.server.getServerLogs(100)
397
+
398
+ // Get alerts
399
+ const alerts = await sdk.server.getAlerts()
400
+
401
+ // Mark alerts as read
402
+ await sdk.server.markAlertAsRead(['alert-id-1', 'alert-id-2'])
403
+ ```
404
+
405
+ ## Error Handling
406
+
407
+ ```typescript
408
+ try {
409
+ await sdk.messages.sendMessage({
410
+ chatGuid: 'invalid-guid',
411
+ message: 'Test'
412
+ })
413
+ } catch (error) {
414
+ if (error.response?.status === 404) {
415
+ console.error('Chat not found')
416
+ } else {
417
+ console.error('Send failed:', error.message)
418
+ }
419
+ }
420
+ ```
421
+
422
+ ## Configuration Options
423
+
424
+ ```typescript
425
+ interface ClientConfig {
426
+ serverUrl?: string // Your subdomain: '{your-subdomain}.imsgd.photon.codes'
427
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' // Default: 'info'
428
+ }
429
+ ```
430
+
431
+ ## Best Practices
432
+
433
+ ### Resource Management
434
+
435
+ ```typescript
436
+ // Always disconnect when done
437
+ process.on('SIGINT', async () => {
438
+ await sdk.disconnect()
439
+ process.exit(0)
440
+ })
441
+ ```
442
+
443
+ ### Event Handling
444
+
445
+ ```typescript
446
+ // Use specific event handlers
447
+ sdk.on('new-message', handleNewMessage)
448
+ sdk.on('error', handleError)
449
+
450
+ // Remove listeners when needed
451
+ sdk.off('new-message', handleNewMessage)
452
+ ```
453
+
454
+ ### Performance Optimization
455
+
456
+ ```typescript
457
+ // Use pagination for large queries
458
+ const messages = await sdk.messages.getMessages({
459
+ chatGuid: 'any;-;+1234567890',
460
+ limit: 100,
461
+ offset: 0
462
+ })
463
+
464
+ // Clear processed message records (prevents memory leaks)
465
+ sdk.clearProcessedMessages(1000)
466
+
467
+ // Get processed message count
468
+ const processedCount = sdk.getProcessedMessageCount()
469
+ ```
470
+
471
+ ## Examples
472
+
473
+ Check the `/examples` directory for complete working examples:
474
+
475
+ - `demo-basic.ts` - Basic SDK usage and event listening
476
+ - `demo-advanced.ts` - Advanced SDK features
477
+ - `message-send.ts` - Send messages
478
+ - `message-attachment.ts` - Send files and images
479
+ - `message-contact-card.ts` - Send contact cards
480
+ - `message-edit.ts` - Edit messages
481
+ - `message-unsend.ts` - Unsend messages
482
+ - `message-reaction.ts` - Add reactions
483
+ - `message-reply.ts` - Reply to messages
484
+ - `message-typing.ts` - Typing indicators
485
+ - `message-scheduled.ts` - Scheduled messages
486
+ - `message-search.ts` - Search messages
487
+ - `message-stats.ts` - Message statistics
488
+ - `chat-group.ts` - Group chat management
489
+ - `chat-fetch.ts` - Fetch chat data
490
+ - `contact-list.ts` - Contact management
491
+ - `facetime-link.ts` - FaceTime integration
492
+ - `findmy-friends.ts` - Find My integration
493
+ - `auto-reply-hey.ts` - Auto-reply example
494
+
495
+ ## License
496
+
497
+ MIT License
@@ -0,0 +1,32 @@
1
+ export declare const SCHEDULED_MESSAGE_ERROR = "scheduled-message-error";
2
+ export declare const SCHEDULED_MESSAGE_SENT = "scheduled-message-sent";
3
+ export declare const SCHEDULED_MESSAGE_DELETED = "scheduled-message-deleted";
4
+ export declare const SCHEDULED_MESSAGE_UPDATED = "scheduled-message-updated";
5
+ export declare const SCHEDULED_MESSAGE_CREATED = "scheduled-message-created";
6
+ export declare const NEW_MESSAGE = "new-message";
7
+ export declare const MESSAGE_SEND_ERROR = "message-send-error";
8
+ export declare const MESSAGE_UPDATED = "updated-message";
9
+ export declare const NEW_SERVER = "new-server";
10
+ export declare const PARTICIPANT_REMOVED = "participant-removed";
11
+ export declare const PARTICIPANT_ADDED = "participant-added";
12
+ export declare const PARTICIPANT_LEFT = "participant-left";
13
+ export declare const GROUP_ICON_CHANGED = "group-icon-changed";
14
+ export declare const GROUP_ICON_REMOVED = "group-icon-removed";
15
+ export declare const CHAT_READ_STATUS_CHANGED = "chat-read-status-changed";
16
+ export declare const HELLO_WORLD = "hello-world";
17
+ export declare const TYPING_INDICATOR = "typing-indicator";
18
+ export declare const SERVER_UPDATE = "server-update";
19
+ export declare const SERVER_UPDATE_DOWNLOADING = "server-update-downloading";
20
+ export declare const SERVER_UPDATE_INSTALLING = "server-update-installing";
21
+ export declare const GROUP_NAME_CHANGE = "group-name-change";
22
+ export declare const INCOMING_FACETIME = "incoming-facetime";
23
+ export declare const SETTINGS_BACKUP_CREATED = "settings-backup-created";
24
+ export declare const SETTINGS_BACKUP_DELETED = "settings-backup-deleted";
25
+ export declare const SETTINGS_BACKUP_UPDATED = "settings-backup-updated";
26
+ export declare const THEME_BACKUP_CREATED = "theme-backup-created";
27
+ export declare const THEME_BACKUP_DELETED = "theme-backup-deleted";
28
+ export declare const THEME_BACKUP_UPDATED = "theme-backup-updated";
29
+ export declare const IMESSAGE_ALIASES_REMOVED = "imessage-aliases-removed";
30
+ export declare const FT_CALL_STATUS_CHANGED = "ft-call-status-changed";
31
+ export declare const NEW_FINDMY_LOCATION = "new-findmy-location";
32
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,yB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duled-message-sent";
3
+ export const SCHEDULED_MESSAGE_DELETED = "scheduled-message-deleted";
4
+ export const SCHEDULED_MESSAGE_UPDATED = "scheduled-message-updated";
5
+ export const SCHEDULED_MESSAGE_CREATED = "scheduled-message-created";
6
+ export const NEW_MESSAGE = "new-message";
7
+ export const MESSAGE_SEND_ERROR = "message-send-error";
8
+ export const MESSAGE_UPDATED = "updated-message";
9
+ export const NEW_SERVER = "new-server";
10
+ export const PARTICIPANT_REMOVED = "participant-removed";
11
+ export const PARTICIPANT_ADDED = "participant-added";
12
+ export const PARTICIPANT_LEFT = "participant-left";
13
+ export const GROUP_ICON_CHANGED = "group-icon-changed";
14
+ export const GROUP_ICON_REMOVED = "group-icon-removed";
15
+ export const CHAT_READ_STATUS_CHANGED = "chat-read-status-changed";
16
+ export const HELLO_WORLD = "hello-world";
17
+ export const TYPING_INDICATOR = "typing-indicator";
18
+ export const SERVER_UPDATE = "server-update";
19
+ export const SERVER_UPDATE_DOWNLOADING = "server-update-downloading";
20
+ export const SERVER_UPDATE_INSTALLING = "server-update-installing";
21
+ export const GROUP_NAME_CHANGE = "group-name-change";
22
+ export const INCOMING_FACETIME = "incoming-facetime";
23
+ export const SETTINGS_BACKUP_CREATED = "settings-backup-created";
24
+ export const SETTINGS_BACKUP_DELETED = "settings-backup-deleted";
25
+ export const SETTINGS_BACKUP_UPDATED = "settings-backup-updated";
26
+ export const THEME_BACKUP_CREATED = "theme-backup-created";
27
+ export const THEME_BACKUP_DELETED = "theme-backup-deleted";
28
+ export const THEME_BACKUP_UPDATED = "theme-backup-updated";
29
+ export const IMESSAGE_ALIASES_REMOVED = "imessage-aliases-removed";
30
+ export const FT_CALL_STATUS_CHANGED = "ft-call-status-changed";
31
+ export const NEW_FINDMY_LOCATION = "new-findmy-location";
32
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../events.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAu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,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import "reflect-metadata";
2
+ export * from "./events";
3
+ export type { Chat, Handle, Message } from "./interfaces";
4
+ export { getLogger, setGlobalLogLevel } from "./lib/Loggable";
5
+ export { AdvancedIMessageKit, SDK } from "./mobai";
6
+ export * from "./types";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AACnD,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import "reflect-metadata";
2
+ export * from "./events";
3
+ export { getLogger, setGlobalLogLevel } from "./lib/Loggable";
4
+ export { AdvancedIMessageKit, SDK } from "./mobai";
5
+ export * from "./types";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AACnD,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { Chat } from "../types/chat";
2
+ export type { Handle } from "../types/handle";
3
+ export type { Message } from "../types/message";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { EventEmitter as EventEmitterClass } from "node:events";
2
+ import type { LogLevel } from "./Logger";
3
+ import { Logger } from "./Logger";
4
+ export declare const setGlobalLogLevel: (level: LogLevel) => void;
5
+ export declare const getLogger: (tag: string) => Logger;
6
+ export declare class Loggable extends EventEmitterClass {
7
+ tag?: string;
8
+ get log(): Logger;
9
+ constructor(tag?: string);
10
+ onLog(listener: (data: {
11
+ level: string;
12
+ message: string;
13
+ tag: string;
14
+ }) => void): void;
15
+ }
16
+ //# sourceMappingURL=Loggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loggable.d.ts","sourceRoot":"","sources":["../../lib/Loggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,SAKhD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,WAQpC,CAAC;AAEF,qBAAa,QAAS,SAAQ,iBAAiB;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,IAAI,GAAG,WAGN;gBAEW,GAAG,CAAC,EAAE,MAAM;IAQxB,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;CAGlF"}
@@ -0,0 +1,34 @@
1
+ import { EventEmitter as EventEmitterClass } from "node:events";
2
+ import { Logger } from "./Logger";
3
+ const loggers = {};
4
+ let globalLogLevel = "info";
5
+ export const setGlobalLogLevel = (level) => {
6
+ globalLogLevel = level;
7
+ Object.values(loggers).forEach((logger) => {
8
+ logger.setLogLevel(level);
9
+ });
10
+ };
11
+ export const getLogger = (tag) => {
12
+ let logger = loggers[tag];
13
+ if (!logger) {
14
+ logger = new Logger(tag, globalLogLevel);
15
+ loggers[tag] = logger;
16
+ }
17
+ return logger;
18
+ };
19
+ export class Loggable extends EventEmitterClass {
20
+ get log() {
21
+ const name = this.tag ?? this.constructor.name;
22
+ return getLogger(name);
23
+ }
24
+ constructor(tag) {
25
+ super();
26
+ if (tag) {
27
+ this.tag = tag;
28
+ }
29
+ }
30
+ onLog(listener) {
31
+ this.log.on("log", listener);
32
+ }
33
+ }
34
+ //# sourceMappingURL=Loggable.js.map