@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,67 @@
1
+ import { HttpClient } from './HttpClient.js';
2
+ import type { MessageDto, SendMessageRequest, EditMessageRequest } from '../types/message.js';
3
+ import type { PaginatedResult } from '../types/common.js';
4
+ /**
5
+ * Message API client.
6
+ * All endpoints require JWT Bearer token.
7
+ */
8
+ export declare class MessageApi {
9
+ private readonly http;
10
+ constructor(http: HttpClient);
11
+ /**
12
+ * POST /api/conversations/{conversationId}/messages
13
+ * Send a new message. Returns 201 Created with the full MessageDto.
14
+ */
15
+ send(conversationId: string, request: SendMessageRequest): Promise<MessageDto>;
16
+ /**
17
+ * GET /api/conversations/{conversationId}/messages?limit={limit}&cursor={cursor}&direction={direction}
18
+ *
19
+ * Fetch message history with cursor-based pagination.
20
+ * direction: 'older' (default) loads messages older than cursor; 'newer' loads newer.
21
+ * NOTE: cursor is a .NET DateTime ticks string — do NOT cast to number.
22
+ */
23
+ getHistory(conversationId: string, params?: {
24
+ limit?: number;
25
+ cursor?: string;
26
+ direction?: 'older' | 'newer';
27
+ }): Promise<PaginatedResult<MessageDto>>;
28
+ /**
29
+ * GET /api/conversations/{conversationId}/messages/search?q={query}&limit={limit}
30
+ * Full-text search within a conversation.
31
+ */
32
+ search(conversationId: string, query: string, limit?: number): Promise<MessageDto[]>;
33
+ /** GET /api/messages/{messageId} */
34
+ getById(messageId: string): Promise<MessageDto>;
35
+ /**
36
+ * PATCH /api/messages/{messageId}
37
+ * Edit message content. Only the original sender can edit.
38
+ * NOTE: REST uses { blocks, mentions } — different from SignalR ChatEditMessageRequest.
39
+ */
40
+ edit(messageId: string, request: EditMessageRequest): Promise<MessageDto>;
41
+ /**
42
+ * DELETE /api/messages/{messageId}
43
+ * Soft-delete a message. Returns { messageId, deletedAt } (not 204).
44
+ */
45
+ delete(messageId: string): Promise<{
46
+ messageId: string;
47
+ deletedAt: string;
48
+ }>;
49
+ /**
50
+ * POST /api/messages/{messageId}/recover
51
+ * Recover a soft-deleted message. Only available within 10 minutes of deletion.
52
+ * Returns 200 OK with no body.
53
+ */
54
+ recover(messageId: string): Promise<void>;
55
+ /**
56
+ * POST /api/messages/{messageId}/reactions
57
+ * Add an emoji reaction. Returns 409 Conflict if already reacted with the same emoji.
58
+ */
59
+ addReaction(messageId: string, emoji: string): Promise<void>;
60
+ /**
61
+ * DELETE /api/messages/{messageId}/reactions/{emoji}
62
+ * Remove an emoji reaction.
63
+ * emoji is automatically URL-encoded (required by the server).
64
+ */
65
+ removeReaction(messageId: string, emoji: string): Promise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AC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAM5E;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D;;;;OAIG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKhE"}
@@ -0,0 +1,91 @@
1
+ // MessageApi.ts — Message operation endpoints
2
+ import { HttpClient } from './HttpClient.js';
3
+ /**
4
+ * Message API client.
5
+ * All endpoints require JWT Bearer token.
6
+ */
7
+ export class MessageApi {
8
+ constructor(http) {
9
+ this.http = http;
10
+ }
11
+ /**
12
+ * POST /api/conversations/{conversationId}/messages
13
+ * Send a new message. Returns 201 Created with the full MessageDto.
14
+ */
15
+ send(conversationId, request) {
16
+ return this.http.post(`/api/conversations/${encodeURIComponent(conversationId)}/messages`, request);
17
+ }
18
+ /**
19
+ * GET /api/conversations/{conversationId}/messages?limit={limit}&cursor={cursor}&direction={direction}
20
+ *
21
+ * Fetch message history with cursor-based pagination.
22
+ * direction: 'older' (default) loads messages older than cursor; 'newer' loads newer.
23
+ * NOTE: cursor is a .NET DateTime ticks string — do NOT cast to number.
24
+ */
25
+ getHistory(conversationId, params) {
26
+ const qs = new URLSearchParams();
27
+ if (params?.limit !== undefined)
28
+ qs.set('limit', String(params.limit));
29
+ if (params?.cursor !== undefined)
30
+ qs.set('cursor', params.cursor);
31
+ if (params?.direction !== undefined)
32
+ qs.set('direction', params.direction);
33
+ const q = qs.toString();
34
+ return this.http.get(`/api/conversations/${encodeURIComponent(conversationId)}/messages${q ? `?${q}` : ''}`);
35
+ }
36
+ /**
37
+ * GET /api/conversations/{conversationId}/messages/search?q={query}&limit={limit}
38
+ * Full-text search within a conversation.
39
+ */
40
+ search(conversationId, query, limit) {
41
+ const qs = new URLSearchParams({ q: query });
42
+ if (limit !== undefined)
43
+ qs.set('limit', String(limit));
44
+ return this.http.get(`/api/conversations/${encodeURIComponent(conversationId)}/messages/search?${qs.toString()}`);
45
+ }
46
+ /** GET /api/messages/{messageId} */
47
+ getById(messageId) {
48
+ return this.http.get(`/api/messages/${encodeURIComponent(messageId)}`);
49
+ }
50
+ /**
51
+ * PATCH /api/messages/{messageId}
52
+ * Edit message content. Only the original sender can edit.
53
+ * NOTE: REST uses { blocks, mentions } — different from SignalR ChatEditMessageRequest.
54
+ */
55
+ edit(messageId, request) {
56
+ return this.http.patch(`/api/messages/${encodeURIComponent(messageId)}`, request);
57
+ }
58
+ /**
59
+ * DELETE /api/messages/{messageId}
60
+ * Soft-delete a message. Returns { messageId, deletedAt } (not 204).
61
+ */
62
+ delete(messageId) {
63
+ return this.http.delete(`/api/messages/${encodeURIComponent(messageId)}`);
64
+ }
65
+ /**
66
+ * POST /api/messages/{messageId}/recover
67
+ * Recover a soft-deleted message. Only available within 10 minutes of deletion.
68
+ * Returns 200 OK with no body.
69
+ */
70
+ recover(messageId) {
71
+ return this.http.post(`/api/messages/${encodeURIComponent(messageId)}/recover`);
72
+ }
73
+ /**
74
+ * POST /api/messages/{messageId}/reactions
75
+ * Add an emoji reaction. Returns 409 Conflict if already reacted with the same emoji.
76
+ */
77
+ addReaction(messageId, emoji) {
78
+ return this.http.post(`/api/messages/${encodeURIComponent(messageId)}/reactions`, {
79
+ emoji,
80
+ });
81
+ }
82
+ /**
83
+ * DELETE /api/messages/{messageId}/reactions/{emoji}
84
+ * Remove an emoji reaction.
85
+ * emoji is automatically URL-encoded (required by the server).
86
+ */
87
+ removeReaction(messageId, emoji) {
88
+ return this.http.delete(`/api/messages/${encodeURIComponent(messageId)}/reactions/${encodeURIComponent(emoji)}`);
89
+ }
90
+ }
91
+ //# sourceMappingURL=MessageApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageApi.js","sourceRoot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BAAkB,CAAC,KAAK,CAAC,EAAE,CACxF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { HttpClient } from './HttpClient.js';
2
+ import type { ParticipantDto, CreateOrUpdateParticipantRequest } from '../types/participant.js';
3
+ /**
4
+ * Participant API client.
5
+ * All endpoints require JWT Bearer token.
6
+ * GET endpoints are cached for 5 minutes on the server.
7
+ */
8
+ export declare class ParticipantApi {
9
+ private readonly http;
10
+ constructor(http: HttpClient);
11
+ /**
12
+ * POST /api/participants
13
+ * Create or update a participant (upsert by ID).
14
+ * Returns 201 Created for new participants, 200 OK for updates.
15
+ */
16
+ createOrUpdate(request: CreateOrUpdateParticipantRequest): Promise<ParticipantDto>;
17
+ /** GET /api/participants/{id} */
18
+ getById(id: string): Promise<ParticipantDto>;
19
+ /** GET /api/participants/by-uniquename/{uniqueName} */
20
+ getByUniqueName(uniqueName: string): Promise<ParticipantDto>;
21
+ /**
22
+ * POST /api/participants/batch
23
+ * Fetch multiple participants by an array of IDs in a single request.
24
+ * Returns only the participants that were found (missing IDs are silently skipped).
25
+ */
26
+ getBatch(ids: string[]): Promise<ParticipantDto[]>;
27
+ }
28
+ //# sourceMappingURL=ParticipantApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticipantApi.d.ts","sourceRoot":"","sources":["../../src/http/ParticipantApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAEhG;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,cAAc,CAAC;IAIlF,iCAAiC;IACjC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAI5C,uDAAuD;IACvD,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAM5D;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAGnD"}
@@ -0,0 +1,37 @@
1
+ // ParticipantApi.ts — Participant management endpoints
2
+ import { HttpClient } from './HttpClient.js';
3
+ /**
4
+ * Participant API client.
5
+ * All endpoints require JWT Bearer token.
6
+ * GET endpoints are cached for 5 minutes on the server.
7
+ */
8
+ export class ParticipantApi {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /**
13
+ * POST /api/participants
14
+ * Create or update a participant (upsert by ID).
15
+ * Returns 201 Created for new participants, 200 OK for updates.
16
+ */
17
+ createOrUpdate(request) {
18
+ return this.http.post('/api/participants', request);
19
+ }
20
+ /** GET /api/participants/{id} */
21
+ getById(id) {
22
+ return this.http.get(`/api/participants/${encodeURIComponent(id)}`);
23
+ }
24
+ /** GET /api/participants/by-uniquename/{uniqueName} */
25
+ getByUniqueName(uniqueName) {
26
+ return this.http.get(`/api/participants/by-uniquename/${encodeURIComponent(uniqueName)}`);
27
+ }
28
+ /**
29
+ * POST /api/participants/batch
30
+ * Fetch multiple participants by an array of IDs in a single request.
31
+ * Returns only the participants that were found (missing IDs are silently skipped).
32
+ */
33
+ getBatch(ids) {
34
+ return this.http.post('/api/participants/batch', ids);
35
+ }
36
+ }
37
+ //# sourceMappingURL=ParticipantApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticipantApi.js","sourceRoot":"","sources":["../../src/http/ParticipantApi.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAGzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,OAAyC;QACtD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAiB,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,iCAAiC;IACjC,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,uDAAuD;IACvD,eAAe,CAAC,UAAkB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,mCAAmC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CACpE,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,GAAa;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAmB,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ import { HttpClient } from './HttpClient.js';
2
+ /**
3
+ * Proxy API client.
4
+ * Forwards requests to registered backend services via the gateway.
5
+ *
6
+ * Example:
7
+ * proxy.get('trading', 'api/stocks/VN30')
8
+ * → GET /api/proxy/trading/api/stocks/VN30
9
+ *
10
+ * Auth: depends on the target service. Pass JWT when required.
11
+ * Error format: simple { "detail": "..." } — handled by ChatApiError.fromResponse().
12
+ */
13
+ export declare class ProxyApi {
14
+ private readonly http;
15
+ constructor(http: HttpClient);
16
+ /**
17
+ * Generic proxy request supporting any HTTP method.
18
+ *
19
+ * @param target - The registered backend target name (e.g. "trading")
20
+ * @param url - The URL path to forward, may include path and query string (e.g. "api/stocks/VN30?page=1")
21
+ * @param options.method - HTTP method (default: GET)
22
+ * @param options.body - Request body (for POST/PATCH)
23
+ * @param options.headers - Additional headers to forward
24
+ */
25
+ request<T>(target: string, url: string, options?: {
26
+ method?: string;
27
+ body?: unknown;
28
+ headers?: Record<string, string>;
29
+ }): Promise<T>;
30
+ /**
31
+ * GET /api/proxy/{target}/{url}
32
+ * Forward a GET request to the target service.
33
+ */
34
+ get<T>(target: string, url: string): Promise<T>;
35
+ /**
36
+ * POST /api/proxy/{target}/{url}
37
+ * Forward a POST request with an optional JSON body to the target service.
38
+ */
39
+ post<T>(target: string, url: string, body?: unknown): Promise<T>;
40
+ }
41
+ //# sourceMappingURL=ProxyApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyApi.d.ts","sourceRoot":"","sources":["../../src/http/ProxyApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,EACP,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GACA,OAAO,CAAC,CAAC,CAAC;IAgBb;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/C;;;OAGG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAGjE"}
@@ -0,0 +1,57 @@
1
+ // ProxyApi.ts — Dynamic backend proxy endpoints
2
+ import { HttpClient } from './HttpClient.js';
3
+ /**
4
+ * Proxy API client.
5
+ * Forwards requests to registered backend services via the gateway.
6
+ *
7
+ * Example:
8
+ * proxy.get('trading', 'api/stocks/VN30')
9
+ * → GET /api/proxy/trading/api/stocks/VN30
10
+ *
11
+ * Auth: depends on the target service. Pass JWT when required.
12
+ * Error format: simple { "detail": "..." } — handled by ChatApiError.fromResponse().
13
+ */
14
+ export class ProxyApi {
15
+ constructor(http) {
16
+ this.http = http;
17
+ }
18
+ /**
19
+ * Generic proxy request supporting any HTTP method.
20
+ *
21
+ * @param target - The registered backend target name (e.g. "trading")
22
+ * @param url - The URL path to forward, may include path and query string (e.g. "api/stocks/VN30?page=1")
23
+ * @param options.method - HTTP method (default: GET)
24
+ * @param options.body - Request body (for POST/PATCH)
25
+ * @param options.headers - Additional headers to forward
26
+ */
27
+ request(target, url, options) {
28
+ const method = (options?.method ?? 'GET').toUpperCase();
29
+ const path = `/api/proxy/${encodeURIComponent(target)}/${url}`;
30
+ switch (method) {
31
+ case 'POST':
32
+ return this.http.post(path, options?.body, options?.headers);
33
+ case 'PATCH':
34
+ return this.http.patch(path, options?.body, options?.headers);
35
+ case 'DELETE':
36
+ return this.http.delete(path, options?.headers);
37
+ default:
38
+ // GET and any other methods use the GET client
39
+ return this.http.get(path, options?.headers);
40
+ }
41
+ }
42
+ /**
43
+ * GET /api/proxy/{target}/{url}
44
+ * Forward a GET request to the target service.
45
+ */
46
+ get(target, url) {
47
+ return this.http.get(`/api/proxy/${encodeURIComponent(target)}/${url}`);
48
+ }
49
+ /**
50
+ * POST /api/proxy/{target}/{url}
51
+ * Forward a POST request with an optional JSON body to the target service.
52
+ */
53
+ post(target, url, body) {
54
+ return this.http.post(`/api/proxy/${encodeURIComponent(target)}/${url}`, body);
55
+ }
56
+ }
57
+ //# sourceMappingURL=ProxyApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyApi.js","sourceRoot":"","sources":["../../src/http/ProxyApi.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,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@ -0,0 +1,26 @@
1
+ export type { PaginatedResult, PagedResult, MediaReference, ProblemDetails, UploadProgressCallback, HealthStatus, HealthCheckResult, } from './types/common.js';
2
+ export type { GoogleLoginRequest, DsAccountLoginRequest, DevLoginRequest, LoginRequest, AuthResponse, AuthUserInfo } from './types/auth.js';
3
+ export type { ParticipantDto, CreateOrUpdateParticipantRequest } from './types/participant.js';
4
+ export type { ConversationType, ConversationParticipantDto, ConversationDto, ConversationListItemDto, CreateConversationRequest, UpdateConversationRequest, AddParticipantRequest, } from './types/conversation.js';
5
+ export type { SenderType, SystemEventType, SystemEventInfo, ReactionGroup, ReactionSummary, MessageDto, SendMessageRequest, EditMessageRequest, MarkAsReadRequest, } from './types/message.js';
6
+ export type { TextFormat, ButtonAction, ButtonStyle, ChoiceMode, QuickReplyAction, MentionType, TextBlock, ImageBlock, VideoBlock, AudioBlock, FileBlock, LinkPreviewBlock, EmbedBlock, LocationBlock, ContactBlock, ChoiceOption, ChoiceBlock, CardField, ActionButton, CardBlock, CarouselBlock, DividerBlock, CustomBlock, Block, QuickReply, Mention, } from './types/block.js';
7
+ export { isTextBlock, isImageBlock, isVideoBlock, isAudioBlock, isFileBlock, isLinkPreviewBlock, isEmbedBlock, isLocationBlock, isContactBlock, isChoiceBlock, isCardBlock, isCarouselBlock, isDividerBlock, isCustomBlock, } from './types/block.js';
8
+ export type { CreateUploadUrlRequest, CreateUploadUrlResponse, UploadResponse } from './types/file.js';
9
+ export type { BotDto, CreateBotRequest, UpdateBotRequest, RegenerateKeyResponse } from './types/bot.js';
10
+ export type { SystemEventDto, ReactionGroupDto, ChatMessageDto, MessageUpdatedDto, DeleteType, MessageDeletedDto, ReactionAddedDto, ReactionRemovedDto, TypingDto, ReadReceiptUpdatedDto, StreamStartedDto, StreamStatusUpdatedDto, StreamChunkReceivedDto, StreamCompletedDto, StreamAbortedDto, } from './types/chat-events.js';
11
+ export type { PresenceStateItem, PresenceChangedDto, NewMessageNotificationDto, MentionedNotificationDto, UnreadCountChangedDto, ConversationCreatedDto, ConversationUpdatedDto, ParticipantJoinedDto, ParticipantLeftDto, ConversationPinnedDto, ConversationUnpinnedDto, ReadStatusChangedDto, } from './types/notification-events.js';
12
+ export type { ChatSendMessageRequest, ChatEditMessageRequest, ChatDeleteMessageRequest, ChatRecoverMessageRequest, ChatAddReactionRequest, ChatRemoveReactionRequest, SendMessageAck, EditMessageAck, DeleteMessageAck, RecoverMessageAck, ReactionAck, MarkAsReadAck, HubErrorDto, } from './types/signalr.js';
13
+ export { ChatApiError } from './errors/ChatApiError.js';
14
+ export { HttpClient } from './http/HttpClient.js';
15
+ export type { HttpClientOptions } from './http/HttpClient.js';
16
+ export { TypedEventEmitter } from './utils/TypedEventEmitter.js';
17
+ export type { Unsubscribe } from './utils/TypedEventEmitter.js';
18
+ export { ChatHubClient } from './realtime/ChatHubClient.js';
19
+ export type { ChatHubClientOptions, ChatHubEventMap } from './realtime/ChatHubClient.js';
20
+ export { NotificationHubClient } from './realtime/NotificationHubClient.js';
21
+ export type { NotificationHubClientOptions, NotificationHubEventMap, } from './realtime/NotificationHubClient.js';
22
+ export { ReconnectionManager } from './realtime/ReconnectionManager.js';
23
+ export type { ReconnectionManagerOptions } from './realtime/ReconnectionManager.js';
24
+ export { ChatClient } from './ChatClient.js';
25
+ export type { ChatClientOptions, ChatClientSignalrOptions, ChatClientRealtime } from './ChatClient.js';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG5I,YAAY,EAAE,cAAc,E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+1,18 @@
1
+ // index.ts — Public SDK API — re-exports everything
2
+ // Block type guards
3
+ export { isTextBlock, isImageBlock, isVideoBlock, isAudioBlock, isFileBlock, isLinkPreviewBlock, isEmbedBlock, isLocationBlock, isContactBlock, isChoiceBlock, isCardBlock, isCarouselBlock, isDividerBlock, isCustomBlock, } from './types/block.js';
4
+ // Errors
5
+ export { ChatApiError } from './errors/ChatApiError.js';
6
+ // HTTP client
7
+ export { HttpClient } from './http/HttpClient.js';
8
+ // Utils — TypedEventEmitter
9
+ export { TypedEventEmitter } from './utils/TypedEventEmitter.js';
10
+ // Real-time — ChatHubClient
11
+ export { ChatHubClient } from './realtime/ChatHubClient.js';
12
+ // Real-time — NotificationHubClient
13
+ export { NotificationHubClient } from './realtime/NotificationHubClient.js';
14
+ // Real-time — ReconnectionManager
15
+ export { ReconnectionManager } from './realtime/ReconnectionManager.js';
16
+ // ChatClient — Main SDK facade (Phase 4)
17
+ export { ChatClient } from './ChatClient.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAyEpD,oBAAoB;AACpB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,kBAAkB,CAAC;AA4D1B,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,4BAA4B;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,4BAA4B;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,oCAAoC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAM5E,kCAAkC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,yCAAyC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { HubConnectionState, LogLevel } from '@microsoft/signalr';
2
+ import type { Unsubscribe } from '../utils/TypedEventEmitter.js';
3
+ import type { ChatMessageDto, MessageUpdatedDto, MessageDeletedDto, ReactionAddedDto, ReactionRemovedDto, TypingDto, ReadReceiptUpdatedDto, StreamStartedDto, StreamStatusUpdatedDto, StreamChunkReceivedDto, StreamCompletedDto, StreamAbortedDto } from '../types/chat-events.js';
4
+ import type { ChatSendMessageRequest, ChatEditMessageRequest, ChatDeleteMessageRequest, ChatRecoverMessageRequest, ChatAddReactionRequest, ChatRemoveReactionRequest, SendMessageAck, EditMessageAck, DeleteMessageAck, RecoverMessageAck, ReactionAck, MarkAsReadAck, HubErrorDto } from '../types/signalr.js';
5
+ export interface ChatHubEventMap {
6
+ messageReceived: ChatMessageDto;
7
+ messageUpdated: MessageUpdatedDto;
8
+ messageDeleted: MessageDeletedDto;
9
+ /** Payload is full ChatMessageDto — same shape as messageReceived */
10
+ messageRecovered: ChatMessageDto;
11
+ reactionAdded: ReactionAddedDto;
12
+ reactionRemoved: ReactionRemovedDto;
13
+ typingStarted: TypingDto;
14
+ typingStopped: TypingDto;
15
+ readReceiptUpdated: ReadReceiptUpdatedDto;
16
+ streamStarted: StreamStartedDto;
17
+ streamStatusUpdated: StreamStatusUpdatedDto;
18
+ streamChunkReceived: StreamChunkReceivedDto;
19
+ streamCompleted: StreamCompletedDto;
20
+ streamAborted: StreamAbortedDto;
21
+ error: HubErrorDto;
22
+ reconnecting: Error | undefined;
23
+ reconnected: string | undefined;
24
+ disconnected: Error | undefined;
25
+ }
26
+ export interface ChatHubClientOptions {
27
+ /** Full URL of the ChatHub endpoint, e.g. "https://api.example.com/hubs/chat" */
28
+ hubUrl: string;
29
+ /** Returns the current JWT token to use as access_token query param */
30
+ tokenProvider: () => string | null;
31
+ /** Minimum log level for SignalR internal logging (default: Warning) */
32
+ logLevel?: LogLevel;
33
+ }
34
+ /**
35
+ * Typed client for the ChatHub (`/hubs/chat`).
36
+ *
37
+ * Responsibilities:
38
+ * - Manages HubConnection lifecycle (connect / disconnect / auto-reconnect)
39
+ * - Exposes typed Hub methods (Client → Server)
40
+ * - Exposes typed event subscription (Server → Client)
41
+ * - Tracks joined conversations so ReconnectionManager can re-join on reconnect
42
+ */
43
+ export declare class ChatHubClient {
44
+ private readonly options;
45
+ private connection;
46
+ private readonly emitter;
47
+ /** Set of conversationIds that have been joined in the current session */
48
+ readonly joinedConversations: Set<string>;
49
+ constructor(options: ChatHubClientOptions);
50
+ get state(): HubConnectionState;
51
+ /** Build a new HubConnection using the latest token from tokenProvider */
52
+ private buildConnection;
53
+ /** Attach SignalR server→client event handlers to the connection */
54
+ private attachHandlers;
55
+ /**
56
+ * Connect to ChatHub. If already connected, resolves immediately.
57
+ * Builds a fresh connection using the current token.
58
+ */
59
+ connect(): Promise<void>;
60
+ /**
61
+ * Disconnect from ChatHub and clear joined conversation tracking.
62
+ */
63
+ disconnect(): Promise<void>;
64
+ private safeStop;
65
+ /**
66
+ * Re-join all tracked conversations. Called internally after reconnect.
67
+ * Called by ReconnectionManager as well.
68
+ */
69
+ rejoinConversations(): Promise<void>;
70
+ private invokeHub;
71
+ joinConversation(conversationId: string): Promise<void>;
72
+ leaveConversation(conversationId: string): Promise<void>;
73
+ startTyping(conversationId: string): Promise<void>;
74
+ stopTyping(conversationId: string): Promise<void>;
75
+ markAsRead(conversationId: string, messageId: string): Promise<MarkAsReadAck>;
76
+ sendMessage(request: ChatSendMessageRequest): Promise<SendMessageAck>;
77
+ editMessage(request: ChatEditMessageRequest): Promise<EditMessageAck>;
78
+ /** Server expects an object { messageId }, not a bare string */
79
+ deleteMessage(request: ChatDeleteMessageRequest): Promise<DeleteMessageAck>;
80
+ /** Server expects an object { messageId }, not a bare string */
81
+ recoverMessage(request: ChatRecoverMessageRequest): Promise<RecoverMessageAck>;
82
+ addReaction(request: ChatAddReactionRequest): Promise<ReactionAck>;
83
+ removeReaction(request: ChatRemoveReactionRequest): Promise<ReactionAck>;
84
+ on<K extends keyof ChatHubEventMap>(event: K, handler: (payload: ChatHubEventMap[K]) => void): Unsubscribe;
85
+ off<K extends keyof ChatHubEventMap>(event: K, handler: (payload: ChatHubEventMap[K]) => void): void;
86
+ }
87
+ //# sourceMappingURL=ChatHubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatHubClient.d.ts","sourceRoot":"","sources":["../../src/realtime/ChatHubClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,kBAAkB,EAClB,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEpF,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAM7B,MAAM,WAAW,eAAe;IAE9B,eAAe,EAAE,cAAc,CAAC;IAChC,cAAc,EAAE,iBAAiB,CAAC;IAClC,cAAc,EAAE,iBAAiB,CAAC;IAClC,qEAAqE;IACrE,gBAAgB,EAAE,cAAc,CAAC;IAGjC,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE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