msteams-mcp 0.19.0 → 0.19.2
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/dist/api/chatsvc-activity.d.ts +49 -0
- package/dist/api/chatsvc-activity.js +138 -0
- package/dist/api/chatsvc-api.d.ts +14 -346
- package/dist/api/chatsvc-api.js +15 -1108
- package/dist/api/chatsvc-common.d.ts +12 -0
- package/dist/api/chatsvc-common.js +34 -0
- package/dist/api/chatsvc-common.test.d.ts +4 -0
- package/dist/api/chatsvc-common.test.js +36 -0
- package/dist/api/chatsvc-messaging.d.ts +171 -0
- package/dist/api/chatsvc-messaging.js +645 -0
- package/dist/api/chatsvc-reactions.d.ts +28 -0
- package/dist/api/chatsvc-reactions.js +58 -0
- package/dist/api/chatsvc-readstatus.d.ts +46 -0
- package/dist/api/chatsvc-readstatus.js +127 -0
- package/dist/api/chatsvc-virtual.d.ts +84 -0
- package/dist/api/chatsvc-virtual.js +160 -0
- package/dist/api/csa-api.js +1 -8
- package/dist/api/files-api.js +11 -18
- package/dist/api/substrate-api.js +5 -20
- package/dist/auth/crypto.test.d.ts +4 -0
- package/dist/auth/crypto.test.js +73 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/types/api-responses.d.ts +155 -0
- package/dist/types/api-responses.js +8 -0
- package/dist/types/errors.test.d.ts +4 -0
- package/dist/types/errors.test.js +104 -0
- package/dist/types/result.test.d.ts +4 -0
- package/dist/types/result.test.js +93 -0
- package/dist/types/teams.d.ts +0 -49
- package/dist/utils/auth-guards.d.ts +48 -0
- package/dist/utils/auth-guards.js +58 -1
- package/dist/utils/auth-guards.test.d.ts +6 -0
- package/dist/utils/auth-guards.test.js +47 -0
- package/dist/utils/parsers.js +12 -35
- package/dist/utils/parsers.test.js +316 -1
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Service API - Activity feed operations.
|
|
3
|
+
*
|
|
4
|
+
* Fetches the user's activity feed (mentions, reactions, replies, notifications).
|
|
5
|
+
*/
|
|
6
|
+
import { type Result } from '../types/result.js';
|
|
7
|
+
import { type ExtractedLink } from '../utils/parsers.js';
|
|
8
|
+
/** Type of activity item. */
|
|
9
|
+
export type ActivityType = 'mention' | 'reaction' | 'reply' | 'message' | 'unknown';
|
|
10
|
+
/** An activity item from the notifications feed. */
|
|
11
|
+
export interface ActivityItem {
|
|
12
|
+
/** Activity/message ID. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Type of activity (mention, reaction, reply, etc.). */
|
|
15
|
+
type: ActivityType;
|
|
16
|
+
/** Activity content (HTML stripped). */
|
|
17
|
+
content: string;
|
|
18
|
+
/** Raw content type from API. */
|
|
19
|
+
contentType: string;
|
|
20
|
+
/** Sender information. */
|
|
21
|
+
sender: {
|
|
22
|
+
mri: string;
|
|
23
|
+
displayName?: string;
|
|
24
|
+
};
|
|
25
|
+
/** When the activity occurred. */
|
|
26
|
+
timestamp: string;
|
|
27
|
+
/** The source conversation ID (where the activity happened). */
|
|
28
|
+
conversationId?: string;
|
|
29
|
+
/** The conversation/thread topic name. */
|
|
30
|
+
topic?: string;
|
|
31
|
+
/** Direct link to the activity in Teams. */
|
|
32
|
+
activityLink?: string;
|
|
33
|
+
/** Links extracted from content. */
|
|
34
|
+
links?: ExtractedLink[];
|
|
35
|
+
}
|
|
36
|
+
/** Result of fetching the activity feed. */
|
|
37
|
+
export interface GetActivityResult {
|
|
38
|
+
/** Activity items (newest first). */
|
|
39
|
+
activities: ActivityItem[];
|
|
40
|
+
/** Sync state for incremental polling. */
|
|
41
|
+
syncState?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the activity feed (notifications) for the current user.
|
|
45
|
+
* Includes mentions, reactions, replies, and other notifications.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getActivityFeed(options?: {
|
|
48
|
+
limit?: number;
|
|
49
|
+
}): Promise<Result<GetActivityResult>>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Service API - Activity feed operations.
|
|
3
|
+
*
|
|
4
|
+
* Fetches the user's activity feed (mentions, reactions, replies, notifications).
|
|
5
|
+
*/
|
|
6
|
+
import { httpRequest } from '../utils/http.js';
|
|
7
|
+
import { CHATSVC_API, getSkypeAuthHeaders } from '../utils/api-config.js';
|
|
8
|
+
import { ok } from '../types/result.js';
|
|
9
|
+
import { requireMessageAuthWithConfig, getTeamsBaseUrl, getTenantId } from '../utils/auth-guards.js';
|
|
10
|
+
import { stripHtml, extractLinks, buildMessageLink, extractActivityTimestamp } from '../utils/parsers.js';
|
|
11
|
+
import { DEFAULT_ACTIVITY_LIMIT, VIRTUAL_CONVERSATION_PREFIX } from '../constants.js';
|
|
12
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
// Internal Helpers
|
|
14
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
/**
|
|
16
|
+
* Determines the activity type from message content and properties.
|
|
17
|
+
*/
|
|
18
|
+
function detectActivityType(msg) {
|
|
19
|
+
const content = msg.content || '';
|
|
20
|
+
const messageType = msg.messagetype || '';
|
|
21
|
+
// Check for @mention
|
|
22
|
+
if (content.includes('itemtype="http://schema.skype.com/Mention"') ||
|
|
23
|
+
content.includes('itemscope itemtype="http://schema.skype.com/Mention"')) {
|
|
24
|
+
return 'mention';
|
|
25
|
+
}
|
|
26
|
+
// Check for reaction-related message types
|
|
27
|
+
if (messageType.toLowerCase().includes('reaction')) {
|
|
28
|
+
return 'reaction';
|
|
29
|
+
}
|
|
30
|
+
// Check for thread/reply indicators
|
|
31
|
+
if (msg.threadtopic || msg.parentMessageId) {
|
|
32
|
+
return 'reply';
|
|
33
|
+
}
|
|
34
|
+
// Standard message
|
|
35
|
+
if (messageType.includes('RichText') || messageType.includes('Text')) {
|
|
36
|
+
return 'message';
|
|
37
|
+
}
|
|
38
|
+
return 'unknown';
|
|
39
|
+
}
|
|
40
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
41
|
+
// API Functions
|
|
42
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
43
|
+
/**
|
|
44
|
+
* Gets the activity feed (notifications) for the current user.
|
|
45
|
+
* Includes mentions, reactions, replies, and other notifications.
|
|
46
|
+
*/
|
|
47
|
+
export async function getActivityFeed(options = {}) {
|
|
48
|
+
const authResult = requireMessageAuthWithConfig();
|
|
49
|
+
if (!authResult.ok) {
|
|
50
|
+
return authResult;
|
|
51
|
+
}
|
|
52
|
+
const { auth, region, baseUrl } = authResult.value;
|
|
53
|
+
const limit = options.limit ?? DEFAULT_ACTIVITY_LIMIT;
|
|
54
|
+
let url = CHATSVC_API.activityFeed(region, baseUrl);
|
|
55
|
+
url += `?view=msnp24Equivalent&pageSize=${limit}`;
|
|
56
|
+
const response = await httpRequest(url, {
|
|
57
|
+
method: 'GET',
|
|
58
|
+
headers: getSkypeAuthHeaders(auth.skypeToken, auth.authToken, baseUrl),
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
return response;
|
|
62
|
+
}
|
|
63
|
+
const rawMessages = response.value.data.messages;
|
|
64
|
+
const syncState = response.value.data.syncState;
|
|
65
|
+
if (!Array.isArray(rawMessages)) {
|
|
66
|
+
return ok({
|
|
67
|
+
activities: [],
|
|
68
|
+
syncState,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const activities = [];
|
|
72
|
+
for (const raw of rawMessages) {
|
|
73
|
+
const msg = raw;
|
|
74
|
+
// Skip control/system messages that aren't relevant
|
|
75
|
+
const messageType = msg.messagetype;
|
|
76
|
+
if (!messageType ||
|
|
77
|
+
messageType.startsWith('Control/') ||
|
|
78
|
+
messageType === 'ThreadActivity/AddMember' ||
|
|
79
|
+
messageType === 'ThreadActivity/DeleteMember') {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const id = msg.id || msg.originalarrivaltime;
|
|
83
|
+
if (!id)
|
|
84
|
+
continue;
|
|
85
|
+
const content = msg.content || '';
|
|
86
|
+
const contentType = msg.messagetype || 'Text';
|
|
87
|
+
const fromMri = msg.from || '';
|
|
88
|
+
const displayName = msg.imdisplayname || msg.displayName;
|
|
89
|
+
// Safely extract timestamp - returns null if no valid timestamp found
|
|
90
|
+
const timestamp = extractActivityTimestamp(msg);
|
|
91
|
+
if (!timestamp)
|
|
92
|
+
continue;
|
|
93
|
+
// Get source conversation - prefer clumpId (actual source) over conversationid
|
|
94
|
+
// Some activity items have conversationid as "48:notifications" (the virtual conversation)
|
|
95
|
+
// which doesn't work for deep links. clumpId contains the real source conversation.
|
|
96
|
+
const rawConversationId = msg.conversationid || msg.conversationId;
|
|
97
|
+
const clumpId = msg.clumpId;
|
|
98
|
+
// Use clumpId if conversationid is a virtual conversation (48:xxx format)
|
|
99
|
+
const isVirtualConversation = rawConversationId?.startsWith(VIRTUAL_CONVERSATION_PREFIX);
|
|
100
|
+
const conversationId = (isVirtualConversation && clumpId) ? clumpId : rawConversationId;
|
|
101
|
+
const topic = msg.threadtopic || msg.topic;
|
|
102
|
+
// Build activity link if we have a valid source conversation context
|
|
103
|
+
// Skip virtual conversations (48:xxx) as they don't produce working deep links
|
|
104
|
+
let activityLink;
|
|
105
|
+
if (conversationId && !conversationId.startsWith(VIRTUAL_CONVERSATION_PREFIX) && /^\d+$/.test(id)) {
|
|
106
|
+
activityLink = buildMessageLink({
|
|
107
|
+
conversationId,
|
|
108
|
+
messageId: id,
|
|
109
|
+
tenantId: getTenantId() ?? undefined,
|
|
110
|
+
teamsBaseUrl: getTeamsBaseUrl(),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const activityType = detectActivityType(msg);
|
|
114
|
+
// Extract links before stripping HTML
|
|
115
|
+
const links = extractLinks(content);
|
|
116
|
+
activities.push({
|
|
117
|
+
id,
|
|
118
|
+
type: activityType,
|
|
119
|
+
content: stripHtml(content),
|
|
120
|
+
contentType,
|
|
121
|
+
sender: {
|
|
122
|
+
mri: fromMri,
|
|
123
|
+
displayName,
|
|
124
|
+
},
|
|
125
|
+
timestamp,
|
|
126
|
+
conversationId,
|
|
127
|
+
topic,
|
|
128
|
+
activityLink,
|
|
129
|
+
links: links.length > 0 ? links : undefined,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// Sort by timestamp (newest first for activity feed)
|
|
133
|
+
activities.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
134
|
+
return ok({
|
|
135
|
+
activities,
|
|
136
|
+
syncState,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
@@ -3,350 +3,18 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles all calls to teams.microsoft.com/api/chatsvc endpoints.
|
|
5
5
|
* Base URL is extracted from session config to support different Teams environments.
|
|
6
|
-
*/
|
|
7
|
-
import { type Result } from '../types/result.js';
|
|
8
|
-
import { type ExtractedLink } from '../utils/parsers.js';
|
|
9
|
-
/** Result of sending a message. */
|
|
10
|
-
export interface SendMessageResult {
|
|
11
|
-
messageId: string;
|
|
12
|
-
timestamp?: number;
|
|
13
|
-
}
|
|
14
|
-
/** A message from a thread/conversation. */
|
|
15
|
-
export interface ThreadMessage {
|
|
16
|
-
id: string;
|
|
17
|
-
content: string;
|
|
18
|
-
contentType: string;
|
|
19
|
-
sender: {
|
|
20
|
-
mri: string;
|
|
21
|
-
displayName?: string;
|
|
22
|
-
};
|
|
23
|
-
timestamp: string;
|
|
24
|
-
/** Human-readable date with day of week, e.g., "Friday, January 30, 2026, 10:45 AM UTC" */
|
|
25
|
-
when?: string;
|
|
26
|
-
conversationId: string;
|
|
27
|
-
clientMessageId?: string;
|
|
28
|
-
isFromMe?: boolean;
|
|
29
|
-
messageLink?: string;
|
|
30
|
-
links?: ExtractedLink[];
|
|
31
|
-
/** For channel messages: the ID of the thread root post (if this is a reply within a thread) */
|
|
32
|
-
threadRootId?: string;
|
|
33
|
-
/** True if this message is a reply within a channel thread (not a top-level post) */
|
|
34
|
-
isThreadReply?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/** Result of getting thread messages. */
|
|
37
|
-
export interface GetThreadResult {
|
|
38
|
-
conversationId: string;
|
|
39
|
-
messages: ThreadMessage[];
|
|
40
|
-
}
|
|
41
|
-
/** Result of saving/unsaving a message. */
|
|
42
|
-
export interface SaveMessageResult {
|
|
43
|
-
conversationId: string;
|
|
44
|
-
messageId: string;
|
|
45
|
-
saved: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** A saved message from the virtual 48:saved conversation. */
|
|
48
|
-
export interface SavedMessage {
|
|
49
|
-
id: string;
|
|
50
|
-
content: string;
|
|
51
|
-
contentType: string;
|
|
52
|
-
sender: {
|
|
53
|
-
mri: string;
|
|
54
|
-
displayName?: string;
|
|
55
|
-
};
|
|
56
|
-
timestamp: string;
|
|
57
|
-
/** The original conversation where this message lives. */
|
|
58
|
-
sourceConversationId: string;
|
|
59
|
-
/** The original message ID in the source conversation. */
|
|
60
|
-
sourceMessageId?: string;
|
|
61
|
-
messageLink?: string;
|
|
62
|
-
links?: ExtractedLink[];
|
|
63
|
-
}
|
|
64
|
-
/** Result of getting saved messages. */
|
|
65
|
-
export interface GetSavedMessagesResult {
|
|
66
|
-
messages: SavedMessage[];
|
|
67
|
-
}
|
|
68
|
-
/** A followed thread from the virtual 48:threads conversation. */
|
|
69
|
-
export interface FollowedThread {
|
|
70
|
-
id: string;
|
|
71
|
-
content: string;
|
|
72
|
-
contentType: string;
|
|
73
|
-
sender: {
|
|
74
|
-
mri: string;
|
|
75
|
-
displayName?: string;
|
|
76
|
-
};
|
|
77
|
-
timestamp: string;
|
|
78
|
-
/** The original conversation/thread where this post lives. */
|
|
79
|
-
sourceConversationId: string;
|
|
80
|
-
/** The original post ID in the source conversation. */
|
|
81
|
-
sourcePostId?: string;
|
|
82
|
-
messageLink?: string;
|
|
83
|
-
links?: ExtractedLink[];
|
|
84
|
-
}
|
|
85
|
-
/** Result of getting followed threads. */
|
|
86
|
-
export interface GetFollowedThreadsResult {
|
|
87
|
-
threads: FollowedThread[];
|
|
88
|
-
}
|
|
89
|
-
/** Options for sending a message. */
|
|
90
|
-
export interface SendMessageOptions {
|
|
91
|
-
/**
|
|
92
|
-
* Message ID of the thread root to reply to.
|
|
93
|
-
*
|
|
94
|
-
* When provided, the message is posted as a reply to an existing thread
|
|
95
|
-
* in a channel. The conversationId should be the channel ID, and this
|
|
96
|
-
* should be the ID of the first message in the thread.
|
|
97
|
-
*
|
|
98
|
-
* For chats (1:1, group, meeting), this is not needed - all messages
|
|
99
|
-
* are part of the same flat conversation.
|
|
100
|
-
*/
|
|
101
|
-
replyToMessageId?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Sends a message to a Teams conversation.
|
|
105
|
-
*
|
|
106
|
-
* For channels, you can either:
|
|
107
|
-
* - Post a new top-level message: just provide the channel's conversationId
|
|
108
|
-
* - Reply to a thread: provide the channel's conversationId AND replyToMessageId
|
|
109
|
-
*
|
|
110
|
-
* For chats (1:1, group, meeting), all messages go to the same conversation
|
|
111
|
-
* without threading - just provide the conversationId.
|
|
112
|
-
*/
|
|
113
|
-
export declare function sendMessage(conversationId: string, content: string, options?: SendMessageOptions): Promise<Result<SendMessageResult>>;
|
|
114
|
-
/**
|
|
115
|
-
* Sends a message to your own notes/self-chat.
|
|
116
|
-
*/
|
|
117
|
-
export declare function sendNoteToSelf(content: string): Promise<Result<SendMessageResult>>;
|
|
118
|
-
/**
|
|
119
|
-
* Gets messages from a Teams conversation/thread.
|
|
120
6
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
export declare function getSavedMessages(options?: {
|
|
136
|
-
limit?: number;
|
|
137
|
-
}): Promise<Result<GetSavedMessagesResult>>;
|
|
138
|
-
/**
|
|
139
|
-
* Gets followed threads from the virtual 48:threads conversation.
|
|
140
|
-
* Returns threads the user is following for updates.
|
|
141
|
-
*/
|
|
142
|
-
export declare function getFollowedThreads(options?: {
|
|
143
|
-
limit?: number;
|
|
144
|
-
}): Promise<Result<GetFollowedThreadsResult>>;
|
|
145
|
-
/**
|
|
146
|
-
* Saves (bookmarks) a message.
|
|
147
|
-
*
|
|
148
|
-
* @param rootMessageId - For channel threaded replies, the ID of the thread root post.
|
|
149
|
-
* For top-level posts and non-channel messages, omit or pass undefined.
|
|
150
|
-
*/
|
|
151
|
-
export declare function saveMessage(conversationId: string, messageId: string, rootMessageId?: string): Promise<Result<SaveMessageResult>>;
|
|
152
|
-
/**
|
|
153
|
-
* Unsaves (removes bookmark from) a message.
|
|
154
|
-
*
|
|
155
|
-
* @param rootMessageId - For channel threaded replies, the ID of the thread root post.
|
|
156
|
-
* For top-level posts and non-channel messages, omit or pass undefined.
|
|
157
|
-
*/
|
|
158
|
-
export declare function unsaveMessage(conversationId: string, messageId: string, rootMessageId?: string): Promise<Result<SaveMessageResult>>;
|
|
159
|
-
/** Result of editing a message. */
|
|
160
|
-
export interface EditMessageResult {
|
|
161
|
-
messageId: string;
|
|
162
|
-
conversationId: string;
|
|
163
|
-
}
|
|
164
|
-
/** Result of deleting a message. */
|
|
165
|
-
export interface DeleteMessageResult {
|
|
166
|
-
messageId: string;
|
|
167
|
-
conversationId: string;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Edits an existing message.
|
|
171
|
-
*
|
|
172
|
-
* Note: You can only edit your own messages. The API will reject
|
|
173
|
-
* attempts to edit messages from other users.
|
|
174
|
-
*
|
|
175
|
-
* @param conversationId - The conversation containing the message
|
|
176
|
-
* @param messageId - The ID of the message to edit
|
|
177
|
-
* @param newContent - The new content for the message
|
|
178
|
-
*/
|
|
179
|
-
export declare function editMessage(conversationId: string, messageId: string, newContent: string): Promise<Result<EditMessageResult>>;
|
|
180
|
-
/**
|
|
181
|
-
* Deletes a message (soft delete).
|
|
182
|
-
*
|
|
183
|
-
* Note: You can only delete your own messages, unless you are a
|
|
184
|
-
* channel owner/moderator. The API will reject unauthorised attempts.
|
|
185
|
-
*
|
|
186
|
-
* @param conversationId - The conversation containing the message
|
|
187
|
-
* @param messageId - The ID of the message to delete
|
|
188
|
-
*/
|
|
189
|
-
export declare function deleteMessage(conversationId: string, messageId: string): Promise<Result<DeleteMessageResult>>;
|
|
190
|
-
/**
|
|
191
|
-
* Gets properties for a single conversation.
|
|
192
|
-
*/
|
|
193
|
-
export declare function getConversationProperties(conversationId: string): Promise<Result<{
|
|
194
|
-
displayName?: string;
|
|
195
|
-
conversationType?: string;
|
|
196
|
-
}>>;
|
|
197
|
-
/**
|
|
198
|
-
* Extracts unique participant names from recent messages.
|
|
199
|
-
*/
|
|
200
|
-
export declare function extractParticipantNames(conversationId: string): Promise<Result<string | undefined>>;
|
|
201
|
-
/** Result of getting a 1:1 conversation. */
|
|
202
|
-
export interface GetOneOnOneChatResult {
|
|
203
|
-
conversationId: string;
|
|
204
|
-
otherUserId: string;
|
|
205
|
-
currentUserId: string;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Gets the conversation ID for a 1:1 chat with another user.
|
|
209
|
-
*
|
|
210
|
-
* Constructs the predictable format: `19:{id1}_{id2}@unq.gbl.spaces`
|
|
211
|
-
* where IDs are sorted lexicographically. The conversation is created
|
|
212
|
-
* implicitly when the first message is sent.
|
|
213
|
-
*/
|
|
214
|
-
export declare function getOneOnOneChatId(otherUserIdentifier: string): Result<GetOneOnOneChatResult>;
|
|
215
|
-
/** Result of creating a group chat. */
|
|
216
|
-
export interface CreateGroupChatResult {
|
|
217
|
-
/** The newly created conversation ID. */
|
|
218
|
-
conversationId: string;
|
|
219
|
-
/** The member MRIs included in the chat. */
|
|
220
|
-
members: string[];
|
|
221
|
-
/** Optional topic/name set for the chat. */
|
|
222
|
-
topic?: string;
|
|
223
|
-
/** Optional note about the result, e.g. if the ID could not be retrieved. */
|
|
224
|
-
note?: string;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Creates a new group chat with multiple members.
|
|
228
|
-
*
|
|
229
|
-
* Unlike 1:1 chats which have a predictable ID format, group chats require
|
|
230
|
-
* an API call to create. The conversation ID is returned by the server.
|
|
231
|
-
*
|
|
232
|
-
* @param memberIdentifiers - Array of user identifiers (MRI, object ID, or GUID)
|
|
233
|
-
* @param topic - Optional chat topic/name
|
|
234
|
-
* @param region - API region (default: 'amer')
|
|
235
|
-
*
|
|
236
|
-
* @example
|
|
237
|
-
* ```typescript
|
|
238
|
-
* // Create a group chat with 2 other people
|
|
239
|
-
* const result = await createGroupChat(
|
|
240
|
-
* ['8:orgid:abc123...', '8:orgid:def456...'],
|
|
241
|
-
* 'Project Discussion'
|
|
242
|
-
* );
|
|
243
|
-
* if (result.ok) {
|
|
244
|
-
* console.log('Created chat:', result.value.conversationId);
|
|
245
|
-
* }
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
export declare function createGroupChat(memberIdentifiers: string[], topic?: string): Promise<Result<CreateGroupChatResult>>;
|
|
249
|
-
/** Consumption horizon information for a conversation. */
|
|
250
|
-
export interface ConsumptionHorizonInfo {
|
|
251
|
-
/** The conversation/thread ID. */
|
|
252
|
-
conversationId: string;
|
|
253
|
-
/** The version timestamp of the consumption horizon. */
|
|
254
|
-
version?: string;
|
|
255
|
-
/** The last read message ID (timestamp). */
|
|
256
|
-
lastReadMessageId?: string;
|
|
257
|
-
/** The last read timestamp. */
|
|
258
|
-
lastReadTimestamp?: number;
|
|
259
|
-
/** Raw consumption horizons array from API. */
|
|
260
|
-
consumptionHorizons: Array<{
|
|
261
|
-
id: string;
|
|
262
|
-
consumptionHorizon: string;
|
|
263
|
-
}>;
|
|
264
|
-
}
|
|
265
|
-
/** Result of marking a conversation as read. */
|
|
266
|
-
export interface MarkAsReadResult {
|
|
267
|
-
conversationId: string;
|
|
268
|
-
markedUpTo: string;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Gets the consumption horizon (read receipts) for a conversation.
|
|
272
|
-
* The consumption horizon indicates where each user has read up to.
|
|
273
|
-
*/
|
|
274
|
-
export declare function getConsumptionHorizon(conversationId: string): Promise<Result<ConsumptionHorizonInfo>>;
|
|
275
|
-
/**
|
|
276
|
-
* Marks a conversation as read up to a specific message.
|
|
277
|
-
*/
|
|
278
|
-
export declare function markAsRead(conversationId: string, messageId: string): Promise<Result<MarkAsReadResult>>;
|
|
279
|
-
/**
|
|
280
|
-
* Gets unread count for a conversation by comparing consumption horizon
|
|
281
|
-
* with recent messages.
|
|
282
|
-
*/
|
|
283
|
-
export declare function getUnreadStatus(conversationId: string): Promise<Result<{
|
|
284
|
-
conversationId: string;
|
|
285
|
-
unreadCount: number;
|
|
286
|
-
lastReadMessageId?: string;
|
|
287
|
-
latestMessageId?: string;
|
|
288
|
-
}>>;
|
|
289
|
-
/** Type of activity item. */
|
|
290
|
-
export type ActivityType = 'mention' | 'reaction' | 'reply' | 'message' | 'unknown';
|
|
291
|
-
/** An activity item from the notifications feed. */
|
|
292
|
-
export interface ActivityItem {
|
|
293
|
-
/** Activity/message ID. */
|
|
294
|
-
id: string;
|
|
295
|
-
/** Type of activity (mention, reaction, reply, etc.). */
|
|
296
|
-
type: ActivityType;
|
|
297
|
-
/** Activity content (HTML stripped). */
|
|
298
|
-
content: string;
|
|
299
|
-
/** Raw content type from API. */
|
|
300
|
-
contentType: string;
|
|
301
|
-
/** Sender information. */
|
|
302
|
-
sender: {
|
|
303
|
-
mri: string;
|
|
304
|
-
displayName?: string;
|
|
305
|
-
};
|
|
306
|
-
/** When the activity occurred. */
|
|
307
|
-
timestamp: string;
|
|
308
|
-
/** The source conversation ID (where the activity happened). */
|
|
309
|
-
conversationId?: string;
|
|
310
|
-
/** The conversation/thread topic name. */
|
|
311
|
-
topic?: string;
|
|
312
|
-
/** Direct link to the activity in Teams. */
|
|
313
|
-
activityLink?: string;
|
|
314
|
-
/** Links extracted from content. */
|
|
315
|
-
links?: ExtractedLink[];
|
|
316
|
-
}
|
|
317
|
-
/** Result of fetching the activity feed. */
|
|
318
|
-
export interface GetActivityResult {
|
|
319
|
-
/** Activity items (newest first). */
|
|
320
|
-
activities: ActivityItem[];
|
|
321
|
-
/** Sync state for incremental polling. */
|
|
322
|
-
syncState?: string;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Gets the activity feed (notifications) for the current user.
|
|
326
|
-
* Includes mentions, reactions, replies, and other notifications.
|
|
327
|
-
*/
|
|
328
|
-
export declare function getActivityFeed(options?: {
|
|
329
|
-
limit?: number;
|
|
330
|
-
}): Promise<Result<GetActivityResult>>;
|
|
331
|
-
/** Result of adding/removing a reaction. */
|
|
332
|
-
export interface ReactionResult {
|
|
333
|
-
conversationId: string;
|
|
334
|
-
messageId: string;
|
|
335
|
-
emoji: string;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Adds a reaction (emoji) to a message.
|
|
339
|
-
*
|
|
340
|
-
* @param conversationId - The conversation containing the message
|
|
341
|
-
* @param messageId - The message ID to react to
|
|
342
|
-
* @param emojiKey - The emoji key (e.g., 'like', 'heart', 'laugh')
|
|
343
|
-
*/
|
|
344
|
-
export declare function addReaction(conversationId: string, messageId: string, emojiKey: string): Promise<Result<ReactionResult>>;
|
|
345
|
-
/**
|
|
346
|
-
* Removes a reaction (emoji) from a message.
|
|
347
|
-
*
|
|
348
|
-
* @param conversationId - The conversation containing the message
|
|
349
|
-
* @param messageId - The message ID to remove the reaction from
|
|
350
|
-
* @param emojiKey - The emoji key to remove (e.g., 'like', 'heart')
|
|
351
|
-
*/
|
|
352
|
-
export declare function removeReaction(conversationId: string, messageId: string, emojiKey: string): Promise<Result<ReactionResult>>;
|
|
7
|
+
* This barrel file re-exports from focused sub-modules:
|
|
8
|
+
* - chatsvc-messaging: send, edit, delete, thread messages, 1:1/group chat
|
|
9
|
+
* - chatsvc-activity: activity feed (mentions, reactions, replies)
|
|
10
|
+
* - chatsvc-reactions: add/remove emoji reactions
|
|
11
|
+
* - chatsvc-virtual: saved messages, followed threads, save/unsave
|
|
12
|
+
* - chatsvc-readstatus: consumption horizons, mark as read, unread counts
|
|
13
|
+
* - chatsvc-common: shared utilities (date formatting)
|
|
14
|
+
*/
|
|
15
|
+
export * from './chatsvc-messaging.js';
|
|
16
|
+
export * from './chatsvc-activity.js';
|
|
17
|
+
export * from './chatsvc-reactions.js';
|
|
18
|
+
export * from './chatsvc-virtual.js';
|
|
19
|
+
export * from './chatsvc-readstatus.js';
|
|
20
|
+
export * from './chatsvc-common.js';
|