@manonero/chat-client-sdk 1.0.0-beta.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 (110) hide show
  1. package/README.md +2343 -0
  2. package/dist/ChatClient.d.ts +122 -0
  3. package/dist/ChatClient.d.ts.map +1 -0
  4. package/dist/ChatClient.js +173 -0
  5. package/dist/ChatClient.js.map +1 -0
  6. package/dist/errors/ChatApiError.d.ts +22 -0
  7. package/dist/errors/ChatApiError.d.ts.map +1 -0
  8. package/dist/errors/ChatApiError.js +50 -0
  9. package/dist/errors/ChatApiError.js.map +1 -0
  10. package/dist/http/AuthApi.d.ts +26 -0
  11. package/dist/http/AuthApi.d.ts.map +1 -0
  12. package/dist/http/AuthApi.js +35 -0
  13. package/dist/http/AuthApi.js.map +1 -0
  14. package/dist/http/BotApi.d.ts +50 -0
  15. package/dist/http/BotApi.d.ts.map +1 -0
  16. package/dist/http/BotApi.js +67 -0
  17. package/dist/http/BotApi.js.map +1 -0
  18. package/dist/http/ConversationApi.d.ts +81 -0
  19. package/dist/http/ConversationApi.d.ts.map +1 -0
  20. package/dist/http/ConversationApi.js +115 -0
  21. package/dist/http/ConversationApi.js.map +1 -0
  22. package/dist/http/FileApi.d.ts +48 -0
  23. package/dist/http/FileApi.d.ts.map +1 -0
  24. package/dist/http/FileApi.js +68 -0
  25. package/dist/http/FileApi.js.map +1 -0
  26. package/dist/http/HealthApi.d.ts +26 -0
  27. package/dist/http/HealthApi.d.ts.map +1 -0
  28. package/dist/http/HealthApi.js +31 -0
  29. package/dist/http/HealthApi.js.map +1 -0
  30. package/dist/http/HttpClient.d.ts +51 -0
  31. package/dist/http/HttpClient.d.ts.map +1 -0
  32. package/dist/http/HttpClient.js +182 -0
  33. package/dist/http/HttpClient.js.map +1 -0
  34. package/dist/http/MessageApi.d.ts +67 -0
  35. package/dist/http/MessageApi.d.ts.map +1 -0
  36. package/dist/http/MessageApi.js +91 -0
  37. package/dist/http/MessageApi.js.map +1 -0
  38. package/dist/http/ParticipantApi.d.ts +28 -0
  39. package/dist/http/ParticipantApi.d.ts.map +1 -0
  40. package/dist/http/ParticipantApi.js +37 -0
  41. package/dist/http/ParticipantApi.js.map +1 -0
  42. package/dist/http/ProxyApi.d.ts +41 -0
  43. package/dist/http/ProxyApi.d.ts.map +1 -0
  44. package/dist/http/ProxyApi.js +57 -0
  45. package/dist/http/ProxyApi.js.map +1 -0
  46. package/dist/index.d.ts +26 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +18 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/realtime/ChatHubClient.d.ts +87 -0
  51. package/dist/realtime/ChatHubClient.d.ts.map +1 -0
  52. package/dist/realtime/ChatHubClient.js +182 -0
  53. package/dist/realtime/ChatHubClient.js.map +1 -0
  54. package/dist/realtime/NotificationHubClient.d.ts +73 -0
  55. package/dist/realtime/NotificationHubClient.d.ts.map +1 -0
  56. package/dist/realtime/NotificationHubClient.js +162 -0
  57. package/dist/realtime/NotificationHubClient.js.map +1 -0
  58. package/dist/realtime/ReconnectionManager.d.ts +65 -0
  59. package/dist/realtime/ReconnectionManager.d.ts.map +1 -0
  60. package/dist/realtime/ReconnectionManager.js +118 -0
  61. package/dist/realtime/ReconnectionManager.js.map +1 -0
  62. package/dist/types/auth.d.ts +28 -0
  63. package/dist/types/auth.d.ts.map +1 -0
  64. package/dist/types/auth.js +3 -0
  65. package/dist/types/auth.js.map +1 -0
  66. package/dist/types/block.d.ts +148 -0
  67. package/dist/types/block.d.ts.map +1 -0
  68. package/dist/types/block.js +47 -0
  69. package/dist/types/block.js.map +1 -0
  70. package/dist/types/bot.d.ts +48 -0
  71. package/dist/types/bot.d.ts.map +1 -0
  72. package/dist/types/bot.js +3 -0
  73. package/dist/types/bot.js.map +1 -0
  74. package/dist/types/chat-events.d.ts +153 -0
  75. package/dist/types/chat-events.d.ts.map +1 -0
  76. package/dist/types/chat-events.js +3 -0
  77. package/dist/types/chat-events.js.map +1 -0
  78. package/dist/types/common.d.ts +57 -0
  79. package/dist/types/common.d.ts.map +1 -0
  80. package/dist/types/common.js +3 -0
  81. package/dist/types/common.js.map +1 -0
  82. package/dist/types/conversation.d.ts +70 -0
  83. package/dist/types/conversation.d.ts.map +1 -0
  84. package/dist/types/conversation.js +3 -0
  85. package/dist/types/conversation.js.map +1 -0
  86. package/dist/types/file.d.ts +31 -0
  87. package/dist/types/file.d.ts.map +1 -0
  88. package/dist/types/file.js +3 -0
  89. package/dist/types/file.js.map +1 -0
  90. package/dist/types/message.d.ts +83 -0
  91. package/dist/types/message.d.ts.map +1 -0
  92. package/dist/types/message.js +3 -0
  93. package/dist/types/message.js.map +1 -0
  94. package/dist/types/notification-events.d.ts +97 -0
  95. package/dist/types/notification-events.d.ts.map +1 -0
  96. package/dist/types/notification-events.js +3 -0
  97. package/dist/types/notification-events.js.map +1 -0
  98. package/dist/types/participant.d.ts +25 -0
  99. package/dist/types/participant.d.ts.map +1 -0
  100. package/dist/types/participant.js +3 -0
  101. package/dist/types/participant.js.map +1 -0
  102. package/dist/types/signalr.d.ts +87 -0
  103. package/dist/types/signalr.d.ts.map +1 -0
  104. package/dist/types/signalr.js +3 -0
  105. package/dist/types/signalr.js.map +1 -0
  106. package/dist/utils/TypedEventEmitter.d.ts +32 -0
  107. package/dist/utils/TypedEventEmitter.d.ts.map +1 -0
  108. package/dist/utils/TypedEventEmitter.js +60 -0
  109. package/dist/utils/TypedEventEmitter.js.map +1 -0
  110. package/package.json +40 -0
@@ -0,0 +1,31 @@
1
+ export interface CreateUploadUrlRequest {
2
+ fileName: string;
3
+ contentType: string;
4
+ /** File size in bytes, max 50MB */
5
+ fileSize: number;
6
+ }
7
+ export interface CreateUploadUrlResponse {
8
+ /**
9
+ * Relative upload URL (e.g. "/api/files/upload?key=...&sig=...").
10
+ * Must be combined with baseUrl before use.
11
+ */
12
+ uploadUrl: string;
13
+ storageKey: string;
14
+ /** ISO 8601 */
15
+ expiresAt: string;
16
+ }
17
+ export interface UploadResponse {
18
+ /**
19
+ * Relative download URL (e.g. "/api/files/01HXABCDEF/photo.jpg").
20
+ * Must be combined with baseUrl before use.
21
+ */
22
+ downloadUrl: string;
23
+ storageKey: string;
24
+ fileName: string;
25
+ contentType: string;
26
+ /** File size in bytes */
27
+ fileSize: number;
28
+ /** ISO 8601 */
29
+ uploadedAt: string;
30
+ }
31
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/types/file.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ // file.ts — File upload/download types
2
+ export {};
3
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/types/file.ts"],"names":[],"mappings":"AAAA,uCAAuC"}
@@ -0,0 +1,83 @@
1
+ import type { Block, QuickReply, Mention } from './block.js';
2
+ export type SenderType = 'User' | 'Bot' | 'System';
3
+ export type SystemEventType = 'ConversationRenamed' | 'AvatarChanged' | 'MemberAdded' | 'MemberRemoved' | 'MemberLeft' | 'Custom';
4
+ /** System event metadata — REST API version */
5
+ export interface SystemEventInfo {
6
+ type: SystemEventType;
7
+ /** null when there is no actor (e.g. MemberLeft — user left voluntarily) */
8
+ actorId: string | null;
9
+ targetIds?: string[];
10
+ metadata?: Record<string, unknown>;
11
+ }
12
+ /** Reaction on a single emoji (REST API version — flat array item) */
13
+ export interface ReactionGroup {
14
+ emoji: string;
15
+ count: number;
16
+ participantIds: string[];
17
+ }
18
+ /**
19
+ * Reaction summary wrapper (REST API version).
20
+ * NOTE: SignalR ChatMessageDto uses a flat ReactionGroupDto[] array instead.
21
+ */
22
+ export interface ReactionSummary {
23
+ groups: ReactionGroup[];
24
+ totalCount: number;
25
+ }
26
+ /**
27
+ * Full message object — REST API version.
28
+ *
29
+ * Differences from SignalR ChatMessageDto:
30
+ * - Has: timestamp, editedAt, isDeleted, deletedAt, plainTextIndex, reactionSummary
31
+ * - Does NOT have: senderName, senderAvatar, reactions (flat), plainTextContent (SignalR name)
32
+ */
33
+ export interface MessageDto {
34
+ /** ULID assigned by server */
35
+ id: string;
36
+ conversationId: string;
37
+ senderId: string;
38
+ senderType: SenderType;
39
+ /** ISO 8601 — time message was sent */
40
+ timestamp: string;
41
+ blocks: Block[];
42
+ /** Plain text content for search indexing */
43
+ plainTextIndex: string | null;
44
+ replyToMessageId: string | null;
45
+ quickReplies: QuickReply[] | null;
46
+ isEdited: boolean;
47
+ /** ISO 8601 */
48
+ editedAt: string | null;
49
+ isDeleted: boolean;
50
+ /** ISO 8601 */
51
+ deletedAt: string | null;
52
+ reactionSummary: ReactionSummary | null;
53
+ mentions: Mention[] | null;
54
+ /** ISO 8601 — time database record was created */
55
+ createdAt: string;
56
+ /** ISO 8601 */
57
+ updatedAt: string;
58
+ /** Temporary client-generated ID for optimistic rendering */
59
+ clientMessageId: string | null;
60
+ /** Only present when senderType === 'System' */
61
+ systemEvent: SystemEventInfo | null;
62
+ }
63
+ /** Request to send a new message via REST API */
64
+ export interface SendMessageRequest {
65
+ blocks: Block[];
66
+ replyToMessageId?: string;
67
+ quickReplies?: QuickReply[];
68
+ mentions?: Mention[];
69
+ /** Up to 128 characters — for optimistic rendering */
70
+ clientMessageId?: string;
71
+ }
72
+ /**
73
+ * Request to edit a message via REST API.
74
+ * NOTE: Different from SignalR ChatEditMessageRequest which uses newBlocks/newMentions.
75
+ */
76
+ export interface EditMessageRequest {
77
+ blocks: Block[];
78
+ mentions?: Mention[];
79
+ }
80
+ export interface MarkAsReadRequest {
81
+ messageId: string;
82
+ }
83
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEnD,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,eAAe,GACf,aAAa,GACb,eAAe,GACf,YAAY,GACZ,QAAQ,CAAC;AAEb,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,EAA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EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ // message.ts — Message types (REST API version)
2
+ export {};
3
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,gDAAgD"}
@@ -0,0 +1,97 @@
1
+ import type { MediaReference } from './common.js';
2
+ import type { ConversationType } from './conversation.js';
3
+ export interface PresenceStateItem {
4
+ participantId: string;
5
+ isOnline: boolean;
6
+ /** ISO 8601, null when online */
7
+ lastSeenAt?: string;
8
+ }
9
+ export interface PresenceChangedDto {
10
+ participantId: string;
11
+ isOnline: boolean;
12
+ /** ISO 8601, null when online */
13
+ lastSeenAt?: string;
14
+ }
15
+ /** Notification sent to all participants except the sender when a new message arrives */
16
+ export interface NewMessageNotificationDto {
17
+ conversationId: string;
18
+ conversationType: ConversationType;
19
+ conversationName?: string;
20
+ messageId: string;
21
+ senderId: string;
22
+ senderName: string;
23
+ senderAvatar?: MediaReference;
24
+ contentPreview: string;
25
+ /** ISO 8601 */
26
+ sentAt: string;
27
+ }
28
+ /**
29
+ * Notification when current user is mentioned.
30
+ * NOTE: Does NOT include senderAvatar (unlike NewMessageNotificationDto).
31
+ */
32
+ export interface MentionedNotificationDto {
33
+ conversationId: string;
34
+ messageId: string;
35
+ senderId: string;
36
+ senderName: string;
37
+ contentPreview: string;
38
+ /** ISO 8601 */
39
+ sentAt: string;
40
+ }
41
+ export interface UnreadCountChangedDto {
42
+ conversationId: string;
43
+ unreadCount: number;
44
+ /** ISO 8601 */
45
+ lastMessageAt: string;
46
+ lastMessageId: string;
47
+ }
48
+ /** Fired when a conversation is created or the current user is added to one */
49
+ export interface ConversationCreatedDto {
50
+ conversationId: string;
51
+ type: ConversationType;
52
+ name?: string;
53
+ avatar?: MediaReference;
54
+ participantCount: number;
55
+ }
56
+ /** Fired when conversation metadata changes (name, avatar, etc.) */
57
+ export interface ConversationUpdatedDto {
58
+ conversationId: string;
59
+ type: ConversationType;
60
+ name?: string;
61
+ avatar?: MediaReference | null;
62
+ participantCount: number;
63
+ }
64
+ export interface ParticipantJoinedDto {
65
+ conversationId: string;
66
+ participantId: string;
67
+ participantName: string;
68
+ participantAvatar?: MediaReference;
69
+ /** ISO 8601 */
70
+ changedAt: string;
71
+ }
72
+ /** Same shape as ParticipantJoinedDto */
73
+ export interface ParticipantLeftDto {
74
+ conversationId: string;
75
+ participantId: string;
76
+ participantName: string;
77
+ participantAvatar?: MediaReference;
78
+ /** ISO 8601 */
79
+ changedAt: string;
80
+ }
81
+ export interface ConversationPinnedDto {
82
+ conversationId: string;
83
+ /** ISO 8601 */
84
+ pinnedAt: string;
85
+ }
86
+ /** NOTE: Does NOT include pinnedAt (unlike ConversationPinnedDto) */
87
+ export interface ConversationUnpinnedDto {
88
+ conversationId: string;
89
+ }
90
+ export interface ReadStatusChangedDto {
91
+ conversationId: string;
92
+ lastReadMessageId?: string;
93
+ unreadCount: number;
94
+ /** true if user explicitly marked as unread */
95
+ markedAsUnread: boolean;
96
+ }
97
+ //# sourceMappingURL=notification-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-events.d.ts","sourceRoot":"","sources":["../../src/types/notification-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yFAAyF;AACzF,MAAM,WAAW,yBAAyB;IAC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;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qEAAqE;AACrE,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,3 @@
1
+ // notification-events.ts — NotificationHub Server→Client event payload types
2
+ export {};
3
+ //# sourceMappingURL=notification-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-events.js","sourceRoot":"","sources":["../../src/types/notification-events.ts"],"names":[],"mappings":"AAAA,6EAA6E"}
@@ -0,0 +1,25 @@
1
+ import type { MediaReference } from './common.js';
2
+ export interface ParticipantDto {
3
+ id: string;
4
+ uniqueName: string;
5
+ fullName: string;
6
+ /** Supports both internal storage and external URL */
7
+ avatar?: MediaReference;
8
+ gender?: string;
9
+ isBot: boolean;
10
+ isOnline: boolean;
11
+ /** ISO 8601 */
12
+ lastSeenAt?: string;
13
+ /** ISO 8601 */
14
+ createdAt: string;
15
+ /** ISO 8601 */
16
+ updatedAt: string;
17
+ }
18
+ export interface CreateOrUpdateParticipantRequest {
19
+ id: string;
20
+ uniqueName: string;
21
+ fullName: string;
22
+ avatar?: MediaReference;
23
+ gender?: string;
24
+ }
25
+ //# sourceMappingURL=participant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../src/types/participant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gCAAgC;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,3 @@
1
+ // participant.ts — Participant types
2
+ export {};
3
+ //# sourceMappingURL=participant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participant.js","sourceRoot":"","sources":["../../src/types/participant.ts"],"names":[],"mappings":"AAAA,qCAAqC"}
@@ -0,0 +1,87 @@
1
+ import type { Block, QuickReply, Mention } from './block.js';
2
+ export interface ChatSendMessageRequest {
3
+ conversationId: string;
4
+ blocks: Block[];
5
+ replyToMessageId?: string;
6
+ quickReplies?: QuickReply[];
7
+ mentions?: Mention[];
8
+ /** Up to 128 characters — for optimistic rendering */
9
+ clientMessageId?: string;
10
+ }
11
+ /**
12
+ * NOTE: Field names differ from REST EditMessageRequest.
13
+ * REST uses blocks/mentions; SignalR uses newBlocks/newMentions.
14
+ */
15
+ export interface ChatEditMessageRequest {
16
+ messageId: string;
17
+ newBlocks: Block[];
18
+ newMentions?: Mention[];
19
+ }
20
+ /** NOTE: Server expects an object, NOT a bare string */
21
+ export interface ChatDeleteMessageRequest {
22
+ messageId: string;
23
+ }
24
+ /** NOTE: Server expects an object, NOT a bare string */
25
+ export interface ChatRecoverMessageRequest {
26
+ messageId: string;
27
+ }
28
+ export interface ChatAddReactionRequest {
29
+ messageId: string;
30
+ conversationId: string;
31
+ emoji: string;
32
+ }
33
+ export interface ChatRemoveReactionRequest {
34
+ messageId: string;
35
+ emoji: string;
36
+ }
37
+ export interface SendMessageAck {
38
+ success: boolean;
39
+ messageId?: string;
40
+ clientMessageId?: string;
41
+ /** .NET DateTime — ISO 8601 string */
42
+ timestamp?: string;
43
+ errorCode?: string;
44
+ errorMessage?: string;
45
+ }
46
+ export interface EditMessageAck {
47
+ success: boolean;
48
+ messageId?: string;
49
+ /** ISO 8601 */
50
+ editedAt?: string;
51
+ errorCode?: string;
52
+ errorMessage?: string;
53
+ }
54
+ export interface DeleteMessageAck {
55
+ success: boolean;
56
+ messageId?: string;
57
+ /** ISO 8601 */
58
+ deletedAt?: string;
59
+ errorCode?: string;
60
+ errorMessage?: string;
61
+ }
62
+ export interface RecoverMessageAck {
63
+ success: boolean;
64
+ messageId?: string;
65
+ errorCode?: string;
66
+ errorMessage?: string;
67
+ }
68
+ export interface ReactionAck {
69
+ success: boolean;
70
+ messageId?: string;
71
+ emoji?: string;
72
+ errorCode?: string;
73
+ errorMessage?: string;
74
+ }
75
+ export interface MarkAsReadAck {
76
+ success: boolean;
77
+ conversationId?: string;
78
+ errorCode?: string;
79
+ errorMessage?: string;
80
+ }
81
+ /** Hub error sent via 'Error' server→client event */
82
+ export interface HubErrorDto {
83
+ code: string;
84
+ message: string;
85
+ details?: Record<string, unknown>;
86
+ }
87
+ //# sourceMappingURL=signalr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signalr.d.ts","sourceRoot":"","sources":["../../src/types/signalr.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAM7D,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;CACzB;AAED,wDAAwD;AACxD,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wDAAwD;AACxD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAA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
2
+ export {};
3
+ //# sourceMappingURL=signalr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signalr.js","sourceRoot":"","sources":["../../src/types/signalr.ts"],"names":[],"mappings":"AAAA,6FAA6F"}
@@ -0,0 +1,32 @@
1
+ /** Function returned by on() to remove the handler */
2
+ export type Unsubscribe = () => void;
3
+ /**
4
+ * Generic typed event emitter.
5
+ *
6
+ * Usage:
7
+ * type MyEvents = { message: string; count: number };
8
+ * const emitter = new TypedEventEmitter<MyEvents>();
9
+ * const unsub = emitter.on('message', (msg) => console.log(msg));
10
+ * emitter.emit('message', 'hello');
11
+ * unsub(); // removes handler
12
+ */
13
+ export declare class TypedEventEmitter<TEventMap extends object> {
14
+ private readonly handlers;
15
+ /**
16
+ * Subscribe to an event. Returns an unsubscribe function for easy cleanup.
17
+ */
18
+ on<K extends keyof TEventMap>(event: K, handler: (payload: TEventMap[K]) => void): Unsubscribe;
19
+ /**
20
+ * Unsubscribe a specific handler from an event.
21
+ */
22
+ off<K extends keyof TEventMap>(event: K, handler: (payload: TEventMap[K]) => void): void;
23
+ /**
24
+ * Emit an event with the given payload. All registered handlers are called synchronously.
25
+ */
26
+ emit<K extends keyof TEventMap>(event: K, payload: TEventMap[K]): void;
27
+ /**
28
+ * Remove all handlers for all events. Useful for cleanup on disconnect.
29
+ */
30
+ removeAllListeners(): void;
31
+ }
32
+ //# sourceMappingURL=TypedEventEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedEventEmitter.d.ts","sourceRoot":"","sources":["../../src/utils/TypedEventEmitter.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAAC,SAAS,SAAS,MAAM;IACrD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;IAExF;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,SAAS,EAC1B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GACvC,WAAW;IAWd;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,SAAS,EAC3B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GACvC,IAAI;IAUP;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI;IAUtE;;OAEG;IACH,kBAAkB,IAAI,IAAI;CAG3B"}
@@ -0,0 +1,60 @@
1
+ // utils/TypedEventEmitter.ts — Generic typed event emitter for SignalR events
2
+ /**
3
+ * Generic typed event emitter.
4
+ *
5
+ * Usage:
6
+ * type MyEvents = { message: string; count: number };
7
+ * const emitter = new TypedEventEmitter<MyEvents>();
8
+ * const unsub = emitter.on('message', (msg) => console.log(msg));
9
+ * emitter.emit('message', 'hello');
10
+ * unsub(); // removes handler
11
+ */
12
+ export class TypedEventEmitter {
13
+ constructor() {
14
+ this.handlers = new Map();
15
+ }
16
+ /**
17
+ * Subscribe to an event. Returns an unsubscribe function for easy cleanup.
18
+ */
19
+ on(event, handler) {
20
+ let set = this.handlers.get(event);
21
+ if (!set) {
22
+ set = new Set();
23
+ this.handlers.set(event, set);
24
+ }
25
+ const h = handler;
26
+ set.add(h);
27
+ return () => this.off(event, handler);
28
+ }
29
+ /**
30
+ * Unsubscribe a specific handler from an event.
31
+ */
32
+ off(event, handler) {
33
+ const set = this.handlers.get(event);
34
+ if (set) {
35
+ set.delete(handler);
36
+ if (set.size === 0) {
37
+ this.handlers.delete(event);
38
+ }
39
+ }
40
+ }
41
+ /**
42
+ * Emit an event with the given payload. All registered handlers are called synchronously.
43
+ */
44
+ emit(event, payload) {
45
+ const set = this.handlers.get(event);
46
+ if (set) {
47
+ // Copy to avoid mutation issues if a handler unsubscribes during emit
48
+ for (const h of Array.from(set)) {
49
+ h(payload);
50
+ }
51
+ }
52
+ }
53
+ /**
54
+ * Remove all handlers for all events. Useful for cleanup on disconnect.
55
+ */
56
+ removeAllListeners() {
57
+ this.handlers.clear();
58
+ }
59
+ }
60
+ //# sourceMappingURL=TypedEventEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedEventEmitter.js","sourceRoot":"","sources":["../../src/utils/TypedEventEmitter.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAK9E;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACmB,aAAQ,GAAG,IAAI,GAAG,EAAoD,CAAC;IAsD1F,CAAC;IApDC;;OAEG;IACH,EAAE,CACA,KAAQ,EACR,OAAwC;QAExC,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,CAAC,GAAG,OAAqC,CAAC;QAChD,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACX,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,GAAG,CACD,KAAQ,EACR,OAAwC;QAExC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,MAAM,CAAC,OAAqC,CAAC,CAAC;YAClD,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,CAA4B,KAAQ,EAAE,OAAqB;QAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE,CAAC;YACR,sEAAsE;YACtE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,CAAC,CAAC,OAAO,CAAC,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@manonero/chat-client-sdk",
3
+ "version": "1.0.0-beta.0",
4
+ "description": "A TypeScript SDK for building chat clients using Microsoft SignalR.",
5
+ "author": "Manonero",
6
+ "license": "MIT",
7
+ "keywords": ["chat", "sdk", "signalr", "typescript", "realtime"],
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.build.json",
23
+ "typecheck": "tsc -p tsconfig.build.json --noEmit",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "test:coverage": "vitest run --coverage",
27
+ "prepublishOnly": "npm run build && npm test"
28
+ },
29
+ "peerDependencies": {
30
+ "@microsoft/signalr": ">=8.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@microsoft/signalr": "^10.0.0",
34
+ "@vitest/coverage-v8": "^4.1.2",
35
+ "jsdom": "^29.0.1",
36
+ "typescript": "~5.9.3",
37
+ "vite": "^8.0.1",
38
+ "vitest": "^4.1.2"
39
+ }
40
+ }