@microsoft/teams.api 0.2.11 → 0.2.13
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/README.md +37 -37
- package/dist/activities/activity.d.mts +6 -1
- package/dist/activities/activity.d.ts +6 -1
- package/dist/activities/activity.js +35 -9
- package/dist/activities/activity.js.map +1 -1
- package/dist/activities/activity.mjs +35 -9
- package/dist/activities/activity.mjs.map +1 -1
- package/dist/activities/command/command-result.d.mts +2 -2
- package/dist/activities/command/command-result.d.ts +2 -2
- package/dist/activities/command/command-send.d.mts +2 -2
- package/dist/activities/command/command-send.d.ts +2 -2
- package/dist/activities/command/index.d.mts +2 -2
- package/dist/activities/command/index.d.ts +2 -2
- package/dist/activities/conversation/conversation-update.d.mts +2 -2
- package/dist/activities/conversation/conversation-update.d.ts +2 -2
- package/dist/activities/conversation/end-of-conversation.d.mts +2 -2
- package/dist/activities/conversation/end-of-conversation.d.ts +2 -2
- package/dist/activities/conversation/index.d.mts +2 -2
- package/dist/activities/conversation/index.d.ts +2 -2
- package/dist/activities/event/index.d.mts +2 -2
- package/dist/activities/event/index.d.ts +2 -2
- package/dist/activities/event/meeting-end.d.mts +2 -2
- package/dist/activities/event/meeting-end.d.ts +2 -2
- package/dist/activities/event/meeting-participant-join.d.mts +2 -2
- package/dist/activities/event/meeting-participant-join.d.ts +2 -2
- package/dist/activities/event/meeting-participant-leave.d.mts +2 -2
- package/dist/activities/event/meeting-participant-leave.d.ts +2 -2
- package/dist/activities/event/meeting-start.d.mts +2 -2
- package/dist/activities/event/meeting-start.d.ts +2 -2
- package/dist/activities/event/read-receipt.d.mts +2 -2
- package/dist/activities/event/read-receipt.d.ts +2 -2
- package/dist/activities/handoff.d.mts +2 -2
- package/dist/activities/handoff.d.ts +2 -2
- package/dist/activities/index.d.mts +8 -8
- package/dist/activities/index.d.ts +8 -8
- package/dist/activities/install-update/add.d.mts +2 -2
- package/dist/activities/install-update/add.d.ts +2 -2
- package/dist/activities/install-update/index.d.mts +2 -2
- package/dist/activities/install-update/index.d.ts +2 -2
- package/dist/activities/install-update/remove.d.mts +2 -2
- package/dist/activities/install-update/remove.d.ts +2 -2
- package/dist/activities/invoke/adaptive-card/action.d.mts +2 -2
- package/dist/activities/invoke/adaptive-card/action.d.ts +2 -2
- package/dist/activities/invoke/adaptive-card/index.d.mts +2 -2
- package/dist/activities/invoke/adaptive-card/index.d.ts +2 -2
- package/dist/activities/invoke/config/config-fetch.d.mts +2 -2
- package/dist/activities/invoke/config/config-fetch.d.ts +2 -2
- package/dist/activities/invoke/config/config-submit.d.mts +2 -2
- package/dist/activities/invoke/config/config-submit.d.ts +2 -2
- package/dist/activities/invoke/config/index.d.mts +2 -2
- package/dist/activities/invoke/config/index.d.ts +2 -2
- package/dist/activities/invoke/execute-action.d.mts +2 -2
- package/dist/activities/invoke/execute-action.d.ts +2 -2
- package/dist/activities/invoke/file-consent.d.mts +2 -2
- package/dist/activities/invoke/file-consent.d.ts +2 -2
- package/dist/activities/invoke/handoff-action.d.mts +2 -2
- package/dist/activities/invoke/handoff-action.d.ts +2 -2
- package/dist/activities/invoke/index.d.mts +21 -21
- package/dist/activities/invoke/index.d.ts +21 -21
- package/dist/activities/invoke/message/index.d.mts +2 -2
- package/dist/activities/invoke/message/index.d.ts +2 -2
- package/dist/activities/invoke/message/submit-action.d.mts +2 -2
- package/dist/activities/invoke/message/submit-action.d.ts +2 -2
- package/dist/activities/invoke/message-extension/anon-query-link.d.mts +2 -2
- package/dist/activities/invoke/message-extension/anon-query-link.d.ts +2 -2
- package/dist/activities/invoke/message-extension/card-button-clicked.d.mts +2 -2
- package/dist/activities/invoke/message-extension/card-button-clicked.d.ts +2 -2
- package/dist/activities/invoke/message-extension/fetch-task.d.mts +26 -26
- package/dist/activities/invoke/message-extension/fetch-task.d.ts +26 -26
- package/dist/activities/invoke/message-extension/index.d.mts +26 -26
- package/dist/activities/invoke/message-extension/index.d.ts +26 -26
- package/dist/activities/invoke/message-extension/query-link.d.mts +2 -2
- package/dist/activities/invoke/message-extension/query-link.d.ts +2 -2
- package/dist/activities/invoke/message-extension/query-setting-url.d.mts +2 -2
- package/dist/activities/invoke/message-extension/query-setting-url.d.ts +2 -2
- package/dist/activities/invoke/message-extension/query.d.mts +2 -2
- package/dist/activities/invoke/message-extension/query.d.ts +2 -2
- package/dist/activities/invoke/message-extension/select-item.d.mts +2 -2
- package/dist/activities/invoke/message-extension/select-item.d.ts +2 -2
- package/dist/activities/invoke/message-extension/setting.d.mts +2 -2
- package/dist/activities/invoke/message-extension/setting.d.ts +2 -2
- package/dist/activities/invoke/message-extension/submit-action.d.mts +26 -26
- package/dist/activities/invoke/message-extension/submit-action.d.ts +26 -26
- package/dist/activities/invoke/sign-in/index.d.mts +2 -2
- package/dist/activities/invoke/sign-in/index.d.ts +2 -2
- package/dist/activities/invoke/sign-in/token-exchange.d.mts +2 -2
- package/dist/activities/invoke/sign-in/token-exchange.d.ts +2 -2
- package/dist/activities/invoke/sign-in/verify-state.d.mts +2 -2
- package/dist/activities/invoke/sign-in/verify-state.d.ts +2 -2
- package/dist/activities/invoke/tab/index.d.mts +2 -2
- package/dist/activities/invoke/tab/index.d.ts +2 -2
- package/dist/activities/invoke/tab/tab-fetch.d.mts +2 -2
- package/dist/activities/invoke/tab/tab-fetch.d.ts +2 -2
- package/dist/activities/invoke/tab/tab-submit.d.mts +2 -2
- package/dist/activities/invoke/tab/tab-submit.d.ts +2 -2
- package/dist/activities/invoke/task/index.d.mts +2 -2
- package/dist/activities/invoke/task/index.d.ts +2 -2
- package/dist/activities/invoke/task/task-fetch.d.mts +2 -2
- package/dist/activities/invoke/task/task-fetch.d.ts +2 -2
- package/dist/activities/invoke/task/task-submit.d.mts +2 -2
- package/dist/activities/invoke/task/task-submit.d.ts +2 -2
- package/dist/activities/message/index.d.mts +22 -22
- package/dist/activities/message/index.d.ts +22 -22
- package/dist/activities/message/message-delete.d.mts +2 -2
- package/dist/activities/message/message-delete.d.ts +2 -2
- package/dist/activities/message/message-reaction.d.mts +2 -2
- package/dist/activities/message/message-reaction.d.ts +2 -2
- package/dist/activities/message/message-update.d.mts +2 -2
- package/dist/activities/message/message-update.d.ts +2 -2
- package/dist/activities/message/message.d.mts +2 -2
- package/dist/activities/message/message.d.ts +2 -2
- package/dist/activities/message/message.js.map +1 -1
- package/dist/activities/message/message.mjs.map +1 -1
- package/dist/activities/trace.d.mts +2 -2
- package/dist/activities/trace.d.ts +2 -2
- package/dist/activities/typing.d.mts +2 -2
- package/dist/activities/typing.d.ts +2 -2
- package/dist/activities/utils/index.d.mts +26 -26
- package/dist/activities/utils/index.d.ts +26 -26
- package/dist/activities/utils/strip-mentions-text.d.mts +19 -19
- package/dist/activities/utils/strip-mentions-text.d.ts +19 -19
- package/dist/activities/utils/to-activity-params.d.mts +26 -26
- package/dist/activities/utils/to-activity-params.d.ts +26 -26
- package/dist/activities/utils/to-activity-params.js.map +1 -1
- package/dist/activities/utils/to-activity-params.mjs.map +1 -1
- package/dist/clients/bot/sign-in.js.map +1 -1
- package/dist/clients/bot/sign-in.mjs.map +1 -1
- package/dist/clients/bot/token.js.map +1 -1
- package/dist/clients/bot/token.mjs.map +1 -1
- package/dist/clients/conversation/activity.d.mts +26 -26
- package/dist/clients/conversation/activity.d.ts +26 -26
- package/dist/clients/conversation/activity.js.map +1 -1
- package/dist/clients/conversation/activity.mjs.map +1 -1
- package/dist/clients/conversation/index.d.mts +25 -25
- package/dist/clients/conversation/index.d.ts +25 -25
- package/dist/clients/conversation/index.js +1 -1
- package/dist/clients/conversation/index.js.map +1 -1
- package/dist/clients/conversation/index.mjs +1 -1
- package/dist/clients/conversation/index.mjs.map +1 -1
- package/dist/clients/index.d.mts +29 -29
- package/dist/clients/index.d.ts +29 -29
- package/dist/clients/index.js +8 -8
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/index.mjs +4 -4
- package/dist/clients/index.mjs.map +1 -1
- package/dist/clients/user/token.js.map +1 -1
- package/dist/clients/user/token.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/models/activity-like.d.mts +26 -26
- package/dist/models/activity-like.d.ts +26 -26
- package/dist/models/entity/ai-message-entity.d.mts +3 -14
- package/dist/models/entity/ai-message-entity.d.ts +3 -14
- package/dist/models/entity/citation-entity.d.mts +29 -6
- package/dist/models/entity/citation-entity.d.ts +29 -6
- package/dist/models/entity/index.d.mts +2 -1
- package/dist/models/entity/index.d.ts +2 -1
- package/dist/models/entity/message-entity.d.mts +13 -1
- package/dist/models/entity/message-entity.d.ts +13 -1
- package/dist/models/entity/sensitive-usage-entity.d.mts +10 -2
- package/dist/models/entity/sensitive-usage-entity.d.ts +10 -2
- package/dist/models/index.d.mts +21 -21
- package/dist/models/index.d.ts +21 -21
- package/dist/models/invoke-response.d.mts +26 -26
- package/dist/models/invoke-response.d.ts +26 -26
- package/dist/models/messaging-extension/index.d.mts +26 -26
- package/dist/models/messaging-extension/index.d.ts +26 -26
- package/dist/models/messaging-extension/messaging-extension-action-response.d.mts +26 -26
- package/dist/models/messaging-extension/messaging-extension-action-response.d.ts +26 -26
- package/dist/models/messaging-extension/messaging-extension-action.d.mts +26 -26
- package/dist/models/messaging-extension/messaging-extension-action.d.ts +26 -26
- package/dist/models/messaging-extension/messaging-extension-response.d.mts +26 -26
- package/dist/models/messaging-extension/messaging-extension-response.d.ts +26 -26
- package/dist/models/messaging-extension/messaging-extension-result.d.mts +26 -26
- package/dist/models/messaging-extension/messaging-extension-result.d.ts +26 -26
- package/package.json +3 -2
- package/dist/{activity-CU6jHBka.d.ts → activity-BBGVkx41.d.ts} +11 -11
- package/dist/{activity-BSnzJwSH.d.mts → activity-CszVnh5f.d.mts} +11 -11
package/README.md
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
# Teams: Api
|
|
2
|
-
|
|
3
|
-
<p>
|
|
4
|
-
<a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank">
|
|
5
|
-
<img src="https://img.shields.io/npm/v/@microsoft/teams.api" />
|
|
6
|
-
</a>
|
|
7
|
-
<a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=code" target="_blank">
|
|
8
|
-
<img src="https://img.shields.io/bundlephobia/min/@microsoft/teams.api" />
|
|
9
|
-
</a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=dependencies" target="_blank">
|
|
11
|
-
<img src="https://img.shields.io/librariesio/release/npm/@microsoft/teams.api" />
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank">
|
|
14
|
-
<img src="https://img.shields.io/npm/dw/@microsoft/teams.api" />
|
|
15
|
-
</a>
|
|
16
|
-
<a href="https://microsoft.github.io/teams-ai" target="_blank">
|
|
17
|
-
<img src="https://img.shields.io/badge/📖 docs-open-blue" />
|
|
18
|
-
</a>
|
|
19
|
-
</p>
|
|
20
|
-
|
|
21
|
-
Model and client implementations used to send and receive requests from Teams.
|
|
22
|
-
|
|
23
|
-
<a href="https://microsoft.github.io/teams-ai" target="_blank">
|
|
24
|
-
<img src="https://img.shields.io/badge/📖 Getting Started-blue?style=for-the-badge" />
|
|
25
|
-
</a>
|
|
26
|
-
|
|
27
|
-
## Install
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
$: npm install @microsoft/teams.api
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Dependencies
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
1
|
+
# Teams: Api
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/@microsoft/teams.api" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=code" target="_blank">
|
|
8
|
+
<img src="https://img.shields.io/bundlephobia/min/@microsoft/teams.api" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=dependencies" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/librariesio/release/npm/@microsoft/teams.api" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank">
|
|
14
|
+
<img src="https://img.shields.io/npm/dw/@microsoft/teams.api" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://microsoft.github.io/teams-ai" target="_blank">
|
|
17
|
+
<img src="https://img.shields.io/badge/📖 docs-open-blue" />
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
Model and client implementations used to send and receive requests from Teams.
|
|
22
|
+
|
|
23
|
+
<a href="https://microsoft.github.io/teams-ai" target="_blank">
|
|
24
|
+
<img src="https://img.shields.io/badge/📖 Getting Started-blue?style=for-the-badge" />
|
|
25
|
+
</a>
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
$: npm install @microsoft/teams.api
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Dependencies
|
|
34
|
+
|
|
35
|
+
- [`axios`](https://www.npmjs.com/package/axios)
|
|
36
|
+
- [`jwt-decode`](https://www.npmjs.com/package/jwt-decode)
|
|
37
|
+
- [`qs`](https://www.npmjs.com/package/qs)
|
|
@@ -11,9 +11,9 @@ import { CitationAppearance } from '../models/entity/citation-entity.mjs';
|
|
|
11
11
|
import { TenantInfo } from '../models/channel-data/tenant-info.mjs';
|
|
12
12
|
import '../models/role.mjs';
|
|
13
13
|
import '../models/entity/ai-message-entity.mjs';
|
|
14
|
+
import '../models/entity/message-entity.mjs';
|
|
14
15
|
import '../models/entity/client-info-entity.mjs';
|
|
15
16
|
import '../models/entity/mention-entity.mjs';
|
|
16
|
-
import '../models/entity/message-entity.mjs';
|
|
17
17
|
import '../models/entity/sensitive-usage-entity.mjs';
|
|
18
18
|
import '../models/entity/stream-info-entity.mjs';
|
|
19
19
|
import '../models/channel-data/settings.mjs';
|
|
@@ -226,6 +226,11 @@ declare class Activity<T extends string = string> implements IActivity<T> {
|
|
|
226
226
|
* is this a streaming activity
|
|
227
227
|
*/
|
|
228
228
|
isStreaming(): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Get or create the base message entity.
|
|
231
|
+
* There should only be one root level message entity.
|
|
232
|
+
*/
|
|
233
|
+
private ensureSingleRootLevelMessageEntity;
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
export { Activity, type IActivity };
|
|
@@ -11,9 +11,9 @@ import { CitationAppearance } from '../models/entity/citation-entity.js';
|
|
|
11
11
|
import { TenantInfo } from '../models/channel-data/tenant-info.js';
|
|
12
12
|
import '../models/role.js';
|
|
13
13
|
import '../models/entity/ai-message-entity.js';
|
|
14
|
+
import '../models/entity/message-entity.js';
|
|
14
15
|
import '../models/entity/client-info-entity.js';
|
|
15
16
|
import '../models/entity/mention-entity.js';
|
|
16
|
-
import '../models/entity/message-entity.js';
|
|
17
17
|
import '../models/entity/sensitive-usage-entity.js';
|
|
18
18
|
import '../models/entity/stream-info-entity.js';
|
|
19
19
|
import '../models/channel-data/settings.js';
|
|
@@ -226,6 +226,11 @@ declare class Activity<T extends string = string> implements IActivity<T> {
|
|
|
226
226
|
* is this a streaming activity
|
|
227
227
|
*/
|
|
228
228
|
isStreaming(): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Get or create the base message entity.
|
|
231
|
+
* There should only be one root level message entity.
|
|
232
|
+
*/
|
|
233
|
+
private ensureSingleRootLevelMessageEntity;
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
export { Activity, type IActivity };
|
|
@@ -156,7 +156,7 @@ class Activity {
|
|
|
156
156
|
return this;
|
|
157
157
|
}
|
|
158
158
|
withChannelData(value) {
|
|
159
|
-
this.channelData = value;
|
|
159
|
+
this.channelData = { ...this.channelData, ...value };
|
|
160
160
|
return this;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
@@ -183,12 +183,15 @@ class Activity {
|
|
|
183
183
|
* Add the `Generated By AI` label.
|
|
184
184
|
*/
|
|
185
185
|
addAiGenerated() {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
const messageEntity = this.ensureSingleRootLevelMessageEntity();
|
|
187
|
+
if (messageEntity.additionalType?.includes("AIGeneratedContent")) {
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
if (!messageEntity.additionalType) {
|
|
191
|
+
messageEntity.additionalType = [];
|
|
192
|
+
}
|
|
193
|
+
messageEntity.additionalType.push(`AIGeneratedContent`);
|
|
194
|
+
return this;
|
|
192
195
|
}
|
|
193
196
|
/**
|
|
194
197
|
* Enable message feedback
|
|
@@ -204,8 +207,11 @@ class Activity {
|
|
|
204
207
|
* Add citations
|
|
205
208
|
*/
|
|
206
209
|
addCitation(position, appearance) {
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
const messageEntity = this.ensureSingleRootLevelMessageEntity();
|
|
211
|
+
if (!messageEntity.citation) {
|
|
212
|
+
messageEntity.citation = [];
|
|
213
|
+
}
|
|
214
|
+
messageEntity.citation.push({
|
|
209
215
|
"@type": "Claim",
|
|
210
216
|
position,
|
|
211
217
|
appearance: {
|
|
@@ -223,6 +229,7 @@ class Activity {
|
|
|
223
229
|
usageInfo: appearance.usageInfo
|
|
224
230
|
}
|
|
225
231
|
});
|
|
232
|
+
return this;
|
|
226
233
|
}
|
|
227
234
|
/**
|
|
228
235
|
* is this a streaming activity
|
|
@@ -230,6 +237,25 @@ class Activity {
|
|
|
230
237
|
isStreaming() {
|
|
231
238
|
return this.entities?.some((e) => e.type === "streaminfo") || false;
|
|
232
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Get or create the base message entity.
|
|
242
|
+
* There should only be one root level message entity.
|
|
243
|
+
*/
|
|
244
|
+
ensureSingleRootLevelMessageEntity() {
|
|
245
|
+
let mesageEntity = this.entities?.find(
|
|
246
|
+
(e) => e.type === "https://schema.org/Message" && e["@type"] === "Message"
|
|
247
|
+
);
|
|
248
|
+
if (!mesageEntity) {
|
|
249
|
+
mesageEntity = {
|
|
250
|
+
type: "https://schema.org/Message",
|
|
251
|
+
"@type": "Message",
|
|
252
|
+
"@context": "https://schema.org",
|
|
253
|
+
"@id": ""
|
|
254
|
+
};
|
|
255
|
+
this.addEntity(mesageEntity);
|
|
256
|
+
}
|
|
257
|
+
return mesageEntity;
|
|
258
|
+
}
|
|
233
259
|
}
|
|
234
260
|
|
|
235
261
|
exports.Activity = Activity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/activities/activity.ts"],"names":[],"mappings":";;AAqHO,MAAM,QAA4D,CAAA;AAAA;AAAA;AAAA;AAAA,EAI9D,IAAA;AAAA;AAAA;AAAA;AAAA,EAKT,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,MAAS,GAAA;AACX,IAAA,OAAO,KAAK,WAAa,EAAA,MAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,IAAI,OAAU,GAAA;AACZ,IAAA,OAAO,KAAK,WAAa,EAAA,OAAA;AAAA;AAC3B;AAAA;AAAA;A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Account,\n ChannelData,\n ChannelID,\n ChannelInfo,\n CitationAppearance,\n ConversationAccount,\n ConversationReference,\n Entity,\n MeetingInfo,\n NotificationInfo,\n TeamInfo,\n} from '../models';\n\nexport interface IActivity<T extends string = string> {\n /**\n * Contains the type of the activity.\n */\n readonly type: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel(): ChannelInfo | undefined;\n\n /**\n * Information about the team in which the message was sent.\n */\n get team(): TeamInfo | undefined;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting(): MeetingInfo | undefined;\n\n /**\n * Notification settings for the message.\n */\n get notification(): NotificationInfo | undefined;\n\n /**\n * is this a streaming activity\n */\n isStreaming(): boolean;\n}\n\nexport class Activity<T extends string = string> implements IActivity<T> {\n /**\n * Contains the type of the activity.\n */\n readonly type!: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id!: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId!: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from!: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation!: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient!: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get tenant() {\n return this.channelData?.tenant;\n }\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel() {\n return this.channelData?.channel;\n }\n\n /**\n * Information about the team in which the message was sent.\n */\n get team() {\n return this.channelData?.team;\n }\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting() {\n return this.channelData?.meeting;\n }\n\n /**\n * Notification settings for the message.\n */\n get notification() {\n return this.channelData?.notification;\n }\n\n constructor(value: Pick<IActivity<T>, 'type'> & Partial<Omit<IActivity<T>, 'type'>>) {\n Object.assign(this, {\n channelId: 'msteams',\n ...value,\n });\n }\n\n static from(activity: IActivity) {\n return new Activity(activity);\n }\n\n toInterface(): IActivity {\n return Object.assign({}, this);\n }\n\n clone(options: Omit<Partial<IActivity>, 'type'> = {}) {\n return new Activity({\n ...this.toInterface(),\n ...options,\n });\n }\n\n withId(value: string) {\n this.id = value;\n return this;\n }\n\n withReplyToId(value: string) {\n this.replyToId = value;\n return this;\n }\n\n withChannelId(value: ChannelID) {\n this.channelId = value;\n return this;\n }\n\n withFrom(value: Account) {\n this.from = value;\n return this;\n }\n\n withConversation(value: ConversationAccount) {\n this.conversation = value;\n return this;\n }\n\n withRelatesTo(value: ConversationReference) {\n this.relatesTo = value;\n return this;\n }\n\n withRecipient(value: Account) {\n this.recipient = value;\n return this;\n }\n\n withServiceUrl(value: string) {\n this.serviceUrl = value;\n return this;\n }\n\n withTimestamp(value: Date) {\n this.timestamp = value;\n return this;\n }\n\n withLocale(value: string) {\n this.locale = value;\n return this;\n }\n\n withLocalTimestamp(value: Date) {\n this.localTimestamp = value;\n return this;\n }\n\n withChannelData(value: ChannelData) {\n this.channelData = value;\n return this;\n }\n\n /**\n * Add an entity.\n */\n addEntity(value: Entity) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(value);\n return this;\n }\n\n /**\n * Add multiple entities\n */\n addEntities(...value: Entity[]) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(...value);\n return this;\n }\n\n /**\n * Add the `Generated By AI` label.\n */\n addAiGenerated() {\n return this.addEntity({\n type: 'https://schema.org/Message',\n '@type': 'Message',\n '@context': 'https://schema.org',\n additionalType: ['AIGeneratedContent'],\n });\n }\n\n /**\n * Enable message feedback\n */\n addFeedback() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.feedbackLoopEnabled = true;\n return this;\n }\n\n /**\n * Add citations\n */\n addCitation(position: number, appearance: CitationAppearance) {\n return this.addEntity({\n type: 'https://schema.org/Message',\n '@type': 'Claim',\n position,\n appearance: {\n '@type': 'DigitalDocument',\n abstract: appearance.abstract,\n name: appearance.name,\n encodingFormat: 'application/vnd.microsoft.card.adaptive',\n image: appearance.icon\n ? {\n '@type': 'ImageObject',\n name: appearance.icon,\n }\n : undefined,\n keywords: appearance.keywords,\n text: appearance.text,\n url: appearance.url,\n usageInfo: appearance.usageInfo,\n },\n });\n }\n\n /**\n * is this a streaming activity\n */\n isStreaming() {\n return this.entities?.some((e) => e.type === 'streaminfo') || false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/activities/activity.ts"],"names":[],"mappings":";;AAwHO,MAAM,QAA4D,CAAA;AAAA;AAAA;AAAA;AAAA,EAI9D,IAAA;AAAA;AAAA;AAAA;AAAA,EAKT,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,MAAS,GAAA;AACX,IAAA,OAAO,KAAK,WAAa,EAAA,MAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,IAAI,OAAU,GAAA;AACZ,IAAA,OAAO,KAAK,WAAa,EAAA,OAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,IAAI,IAAO,GAAA;AACT,IAAA,OAAO,KAAK,WAAa,EAAA,IAAA;AAAA;AAC3B;AAAA;AAA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W,CAAA;AAAA;AACxB,KACD,CAAA;AAED,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA,EAKA,WAAc,GAAA;AACZ,IAAO,OAAA,IAAA,CAAK,UAAU,IAAK,CAAA,CAAC,MAAM,CAAE,CAAA,IAAA,KAAS,YAAY,CAAK,IAAA,KAAA;AAAA;AAChE;AAAA;AAAA;AAAA;AAAA,EAMQ,kCAAoD,GAAA;AAC1D,IAAI,IAAA,YAAA,GAAe,KAAK,QAAU,EAAA,IAAA;AAAA,MAChC,CAAC,CAAM,KAAA,CAAA,CAAE,SAAS,4BAAgC,IAAA,CAAA,CAAE,OAAO,CAAM,KAAA;AAAA,KACnE;AAEA,IAAA,IAAI,CAAC,YAAc,EAAA;AACjB,MAAe,YAAA,GAAA;AAAA,QACb,IAAM,EAAA,4BAAA;AAAA,QACN,OAAS,EAAA,SAAA;AAAA,QACT,UAAY,EAAA,oBAAA;AAAA,QACZ,KAAO,EAAA;AAAA,OACT;AACA,MAAA,IAAA,CAAK,UAAU,YAAY,CAAA;AAAA;AAG7B,IAAO,OAAA,YAAA;AAAA;AAEX","file":"activity.js","sourcesContent":["import {\n Account,\n AIMessageEntity,\n ChannelData,\n ChannelID,\n ChannelInfo,\n CitationAppearance,\n CitationEntity,\n ConversationAccount,\n ConversationReference,\n Entity,\n MeetingInfo,\n MessageEntity,\n NotificationInfo,\n TeamInfo,\n} from '../models';\n\nexport interface IActivity<T extends string = string> {\n /**\n * Contains the type of the activity.\n */\n readonly type: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel(): ChannelInfo | undefined;\n\n /**\n * Information about the team in which the message was sent.\n */\n get team(): TeamInfo | undefined;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting(): MeetingInfo | undefined;\n\n /**\n * Notification settings for the message.\n */\n get notification(): NotificationInfo | undefined;\n\n /**\n * is this a streaming activity\n */\n isStreaming(): boolean;\n}\n\nexport class Activity<T extends string = string> implements IActivity<T> {\n /**\n * Contains the type of the activity.\n */\n readonly type!: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id!: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId!: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from!: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation!: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient!: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get tenant() {\n return this.channelData?.tenant;\n }\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel() {\n return this.channelData?.channel;\n }\n\n /**\n * Information about the team in which the message was sent.\n */\n get team() {\n return this.channelData?.team;\n }\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting() {\n return this.channelData?.meeting;\n }\n\n /**\n * Notification settings for the message.\n */\n get notification() {\n return this.channelData?.notification;\n }\n\n constructor(value: Pick<IActivity<T>, 'type'> & Partial<Omit<IActivity<T>, 'type'>>) {\n Object.assign(this, {\n channelId: 'msteams',\n ...value,\n });\n }\n\n static from(activity: IActivity) {\n return new Activity(activity);\n }\n\n toInterface(): IActivity {\n return Object.assign({}, this);\n }\n\n clone(options: Omit<Partial<IActivity>, 'type'> = {}) {\n return new Activity({\n ...this.toInterface(),\n ...options,\n });\n }\n\n withId(value: string) {\n this.id = value;\n return this;\n }\n\n withReplyToId(value: string) {\n this.replyToId = value;\n return this;\n }\n\n withChannelId(value: ChannelID) {\n this.channelId = value;\n return this;\n }\n\n withFrom(value: Account) {\n this.from = value;\n return this;\n }\n\n withConversation(value: ConversationAccount) {\n this.conversation = value;\n return this;\n }\n\n withRelatesTo(value: ConversationReference) {\n this.relatesTo = value;\n return this;\n }\n\n withRecipient(value: Account) {\n this.recipient = value;\n return this;\n }\n\n withServiceUrl(value: string) {\n this.serviceUrl = value;\n return this;\n }\n\n withTimestamp(value: Date) {\n this.timestamp = value;\n return this;\n }\n\n withLocale(value: string) {\n this.locale = value;\n return this;\n }\n\n withLocalTimestamp(value: Date) {\n this.localTimestamp = value;\n return this;\n }\n\n withChannelData(value: ChannelData) {\n this.channelData = { ...this.channelData, ...value };\n return this;\n }\n\n /**\n * Add an entity.\n */\n addEntity(value: Entity) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(value);\n return this;\n }\n\n /**\n * Add multiple entities\n */\n addEntities(...value: Entity[]) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(...value);\n return this;\n }\n\n /**\n * Add the `Generated By AI` label.\n */\n addAiGenerated() {\n const messageEntity: AIMessageEntity = this.ensureSingleRootLevelMessageEntity();\n if (messageEntity.additionalType?.includes('AIGeneratedContent')) {\n return this;\n }\n\n if (!messageEntity.additionalType) {\n messageEntity.additionalType = [];\n }\n\n messageEntity.additionalType.push(`AIGeneratedContent`);\n return this;\n }\n\n /**\n * Enable message feedback\n */\n addFeedback() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.feedbackLoopEnabled = true;\n return this;\n }\n\n /**\n * Add citations\n */\n addCitation(position: number, appearance: CitationAppearance) {\n const messageEntity: CitationEntity = this.ensureSingleRootLevelMessageEntity();\n if (!messageEntity.citation) {\n messageEntity.citation = [];\n }\n\n messageEntity.citation.push({\n '@type': 'Claim',\n position,\n appearance: {\n '@type': 'DigitalDocument',\n abstract: appearance.abstract,\n name: appearance.name,\n encodingFormat: 'application/vnd.microsoft.card.adaptive',\n image: appearance.icon\n ? {\n '@type': 'ImageObject',\n name: appearance.icon,\n }\n : undefined,\n keywords: appearance.keywords,\n text: appearance.text,\n url: appearance.url,\n usageInfo: appearance.usageInfo,\n },\n });\n\n return this;\n }\n\n /**\n * is this a streaming activity\n */\n isStreaming() {\n return this.entities?.some((e) => e.type === 'streaminfo') || false;\n }\n\n /**\n * Get or create the base message entity.\n * There should only be one root level message entity.\n */\n private ensureSingleRootLevelMessageEntity(): MessageEntity {\n let mesageEntity = this.entities?.find(\n (e) => e.type === 'https://schema.org/Message' && e['@type'] === 'Message'\n ) as MessageEntity | undefined;\n\n if (!mesageEntity) {\n mesageEntity = {\n type: 'https://schema.org/Message',\n '@type': 'Message',\n '@context': 'https://schema.org',\n '@id': '',\n };\n this.addEntity(mesageEntity);\n }\n\n return mesageEntity;\n }\n}\n"]}
|
|
@@ -154,7 +154,7 @@ class Activity {
|
|
|
154
154
|
return this;
|
|
155
155
|
}
|
|
156
156
|
withChannelData(value) {
|
|
157
|
-
this.channelData = value;
|
|
157
|
+
this.channelData = { ...this.channelData, ...value };
|
|
158
158
|
return this;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
@@ -181,12 +181,15 @@ class Activity {
|
|
|
181
181
|
* Add the `Generated By AI` label.
|
|
182
182
|
*/
|
|
183
183
|
addAiGenerated() {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
const messageEntity = this.ensureSingleRootLevelMessageEntity();
|
|
185
|
+
if (messageEntity.additionalType?.includes("AIGeneratedContent")) {
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
if (!messageEntity.additionalType) {
|
|
189
|
+
messageEntity.additionalType = [];
|
|
190
|
+
}
|
|
191
|
+
messageEntity.additionalType.push(`AIGeneratedContent`);
|
|
192
|
+
return this;
|
|
190
193
|
}
|
|
191
194
|
/**
|
|
192
195
|
* Enable message feedback
|
|
@@ -202,8 +205,11 @@ class Activity {
|
|
|
202
205
|
* Add citations
|
|
203
206
|
*/
|
|
204
207
|
addCitation(position, appearance) {
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
const messageEntity = this.ensureSingleRootLevelMessageEntity();
|
|
209
|
+
if (!messageEntity.citation) {
|
|
210
|
+
messageEntity.citation = [];
|
|
211
|
+
}
|
|
212
|
+
messageEntity.citation.push({
|
|
207
213
|
"@type": "Claim",
|
|
208
214
|
position,
|
|
209
215
|
appearance: {
|
|
@@ -221,6 +227,7 @@ class Activity {
|
|
|
221
227
|
usageInfo: appearance.usageInfo
|
|
222
228
|
}
|
|
223
229
|
});
|
|
230
|
+
return this;
|
|
224
231
|
}
|
|
225
232
|
/**
|
|
226
233
|
* is this a streaming activity
|
|
@@ -228,6 +235,25 @@ class Activity {
|
|
|
228
235
|
isStreaming() {
|
|
229
236
|
return this.entities?.some((e) => e.type === "streaminfo") || false;
|
|
230
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Get or create the base message entity.
|
|
240
|
+
* There should only be one root level message entity.
|
|
241
|
+
*/
|
|
242
|
+
ensureSingleRootLevelMessageEntity() {
|
|
243
|
+
let mesageEntity = this.entities?.find(
|
|
244
|
+
(e) => e.type === "https://schema.org/Message" && e["@type"] === "Message"
|
|
245
|
+
);
|
|
246
|
+
if (!mesageEntity) {
|
|
247
|
+
mesageEntity = {
|
|
248
|
+
type: "https://schema.org/Message",
|
|
249
|
+
"@type": "Message",
|
|
250
|
+
"@context": "https://schema.org",
|
|
251
|
+
"@id": ""
|
|
252
|
+
};
|
|
253
|
+
this.addEntity(mesageEntity);
|
|
254
|
+
}
|
|
255
|
+
return mesageEntity;
|
|
256
|
+
}
|
|
231
257
|
}
|
|
232
258
|
|
|
233
259
|
export { Activity };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/activities/activity.ts"],"names":[],"mappings":"AAqHO,MAAM,QAA4D,CAAA;AAAA;AAAA;AAAA;AAAA,EAI9D,IAAA;AAAA;AAAA;AAAA;AAAA,EAKT,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAA;AAAA;AAAA;AAA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A,yCAAA;AAAA,QAChB,KAAA,EAAO,WAAW,IACd,GAAA;AAAA,UACE,OAAS,EAAA,aAAA;AAAA,UACT,MAAM,UAAW,CAAA;AAAA,SAEnB,GAAA,MAAA;AAAA,QACJ,UAAU,UAAW,CAAA,QAAA;AAAA,QACrB,MAAM,UAAW,CAAA,IAAA;AAAA,QACjB,KAAK,UAAW,CAAA,GAAA;AAAA,QAChB,WAAW,UAAW,CAAA;AAAA;AACxB,KACD,CAAA;AAAA;AACH;AAAA;AAAA;AAAA,EAKA,WAAc,GAAA;AACZ,IAAO,OAAA,IAAA,CAAK,UAAU,IAAK,CAAA,CAAC,MAAM,CAAE,CAAA,IAAA,KAAS,YAAY,CAAK,IAAA,KAAA;AAAA;AAElE","file":"activity.mjs","sourcesContent":["import {\n Account,\n ChannelData,\n ChannelID,\n ChannelInfo,\n CitationAppearance,\n ConversationAccount,\n ConversationReference,\n Entity,\n MeetingInfo,\n NotificationInfo,\n TeamInfo,\n} from '../models';\n\nexport interface IActivity<T extends string = string> {\n /**\n * Contains the type of the activity.\n */\n readonly type: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel(): ChannelInfo | undefined;\n\n /**\n * Information about the team in which the message was sent.\n */\n get team(): TeamInfo | undefined;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting(): MeetingInfo | undefined;\n\n /**\n * Notification settings for the message.\n */\n get notification(): NotificationInfo | undefined;\n\n /**\n * is this a streaming activity\n */\n isStreaming(): boolean;\n}\n\nexport class Activity<T extends string = string> implements IActivity<T> {\n /**\n * Contains the type of the activity.\n */\n readonly type!: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id!: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId!: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from!: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation!: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient!: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get tenant() {\n return this.channelData?.tenant;\n }\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel() {\n return this.channelData?.channel;\n }\n\n /**\n * Information about the team in which the message was sent.\n */\n get team() {\n return this.channelData?.team;\n }\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting() {\n return this.channelData?.meeting;\n }\n\n /**\n * Notification settings for the message.\n */\n get notification() {\n return this.channelData?.notification;\n }\n\n constructor(value: Pick<IActivity<T>, 'type'> & Partial<Omit<IActivity<T>, 'type'>>) {\n Object.assign(this, {\n channelId: 'msteams',\n ...value,\n });\n }\n\n static from(activity: IActivity) {\n return new Activity(activity);\n }\n\n toInterface(): IActivity {\n return Object.assign({}, this);\n }\n\n clone(options: Omit<Partial<IActivity>, 'type'> = {}) {\n return new Activity({\n ...this.toInterface(),\n ...options,\n });\n }\n\n withId(value: string) {\n this.id = value;\n return this;\n }\n\n withReplyToId(value: string) {\n this.replyToId = value;\n return this;\n }\n\n withChannelId(value: ChannelID) {\n this.channelId = value;\n return this;\n }\n\n withFrom(value: Account) {\n this.from = value;\n return this;\n }\n\n withConversation(value: ConversationAccount) {\n this.conversation = value;\n return this;\n }\n\n withRelatesTo(value: ConversationReference) {\n this.relatesTo = value;\n return this;\n }\n\n withRecipient(value: Account) {\n this.recipient = value;\n return this;\n }\n\n withServiceUrl(value: string) {\n this.serviceUrl = value;\n return this;\n }\n\n withTimestamp(value: Date) {\n this.timestamp = value;\n return this;\n }\n\n withLocale(value: string) {\n this.locale = value;\n return this;\n }\n\n withLocalTimestamp(value: Date) {\n this.localTimestamp = value;\n return this;\n }\n\n withChannelData(value: ChannelData) {\n this.channelData = value;\n return this;\n }\n\n /**\n * Add an entity.\n */\n addEntity(value: Entity) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(value);\n return this;\n }\n\n /**\n * Add multiple entities\n */\n addEntities(...value: Entity[]) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(...value);\n return this;\n }\n\n /**\n * Add the `Generated By AI` label.\n */\n addAiGenerated() {\n return this.addEntity({\n type: 'https://schema.org/Message',\n '@type': 'Message',\n '@context': 'https://schema.org',\n additionalType: ['AIGeneratedContent'],\n });\n }\n\n /**\n * Enable message feedback\n */\n addFeedback() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.feedbackLoopEnabled = true;\n return this;\n }\n\n /**\n * Add citations\n */\n addCitation(position: number, appearance: CitationAppearance) {\n return this.addEntity({\n type: 'https://schema.org/Message',\n '@type': 'Claim',\n position,\n appearance: {\n '@type': 'DigitalDocument',\n abstract: appearance.abstract,\n name: appearance.name,\n encodingFormat: 'application/vnd.microsoft.card.adaptive',\n image: appearance.icon\n ? {\n '@type': 'ImageObject',\n name: appearance.icon,\n }\n : undefined,\n keywords: appearance.keywords,\n text: appearance.text,\n url: appearance.url,\n usageInfo: appearance.usageInfo,\n },\n });\n }\n\n /**\n * is this a streaming activity\n */\n isStreaming() {\n return this.entities?.some((e) => e.type === 'streaminfo') || false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/activities/activity.ts"],"names":[],"mappings":"AAwHO,MAAM,QAA4D,CAAA;AAAA;AAAA;AAAA;AAAA,EAI9D,IAAA;AAAA;AAAA;AAAA;AAAA,EAKT,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAA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elData,\n ChannelID,\n ChannelInfo,\n CitationAppearance,\n CitationEntity,\n ConversationAccount,\n ConversationReference,\n Entity,\n MeetingInfo,\n MessageEntity,\n NotificationInfo,\n TeamInfo,\n} from '../models';\n\nexport interface IActivity<T extends string = string> {\n /**\n * Contains the type of the activity.\n */\n readonly type: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel(): ChannelInfo | undefined;\n\n /**\n * Information about the team in which the message was sent.\n */\n get team(): TeamInfo | undefined;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting(): MeetingInfo | undefined;\n\n /**\n * Notification settings for the message.\n */\n get notification(): NotificationInfo | undefined;\n\n /**\n * is this a streaming activity\n */\n isStreaming(): boolean;\n}\n\nexport class Activity<T extends string = string> implements IActivity<T> {\n /**\n * Contains the type of the activity.\n */\n readonly type!: T;\n\n /**\n * Contains an ID that uniquely identifies the activity on the channel.\n */\n id!: string;\n\n /**\n * Contains the URL that specifies the channel's service endpoint. Set by the channel.\n */\n serviceUrl?: string;\n\n /**\n * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.\n */\n timestamp?: Date;\n\n /**\n * A locale name for the contents of the text field.\n * The locale name is a combination of an ISO 639 two- or three-letter culture code associated\n * with a language\n * and an ISO 3166 two-letter subculture code associated with a country or region.\n * The locale name can also correspond to a valid BCP-47 language tag.\n */\n locale?: string;\n\n /**\n * Contains the local date and time of the message, expressed in ISO-8601 format.\n *\n * For example, 2016-09-23T13:07:49.4714686-07:00.\n */\n localTimestamp?: Date;\n\n /**\n * Contains an ID that uniquely identifies the channel. Set by the channel.\n */\n channelId!: ChannelID;\n\n /**\n * Identifies the sender of the message.\n */\n from!: Account;\n\n /**\n * Identifies the conversation to which the activity belongs.\n */\n conversation!: ConversationAccount;\n\n /**\n * A reference to another conversation or activity.\n */\n relatesTo?: ConversationReference;\n\n /**\n * Identifies the recipient of the message.\n */\n recipient!: Account;\n\n /**\n * Contains the ID of the message to which this message is a reply.\n */\n replyToId?: string;\n\n /**\n * Represents the entities that were mentioned in the message.\n */\n entities?: Entity[];\n\n /**\n * Contains channel-specific content.\n */\n channelData?: ChannelData;\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get tenant() {\n return this.channelData?.tenant;\n }\n\n /**\n * Information about the channel in which the message was sent.\n */\n get channel() {\n return this.channelData?.channel;\n }\n\n /**\n * Information about the team in which the message was sent.\n */\n get team() {\n return this.channelData?.team;\n }\n\n /**\n * Information about the tenant in which the message was sent.\n */\n get meeting() {\n return this.channelData?.meeting;\n }\n\n /**\n * Notification settings for the message.\n */\n get notification() {\n return this.channelData?.notification;\n }\n\n constructor(value: Pick<IActivity<T>, 'type'> & Partial<Omit<IActivity<T>, 'type'>>) {\n Object.assign(this, {\n channelId: 'msteams',\n ...value,\n });\n }\n\n static from(activity: IActivity) {\n return new Activity(activity);\n }\n\n toInterface(): IActivity {\n return Object.assign({}, this);\n }\n\n clone(options: Omit<Partial<IActivity>, 'type'> = {}) {\n return new Activity({\n ...this.toInterface(),\n ...options,\n });\n }\n\n withId(value: string) {\n this.id = value;\n return this;\n }\n\n withReplyToId(value: string) {\n this.replyToId = value;\n return this;\n }\n\n withChannelId(value: ChannelID) {\n this.channelId = value;\n return this;\n }\n\n withFrom(value: Account) {\n this.from = value;\n return this;\n }\n\n withConversation(value: ConversationAccount) {\n this.conversation = value;\n return this;\n }\n\n withRelatesTo(value: ConversationReference) {\n this.relatesTo = value;\n return this;\n }\n\n withRecipient(value: Account) {\n this.recipient = value;\n return this;\n }\n\n withServiceUrl(value: string) {\n this.serviceUrl = value;\n return this;\n }\n\n withTimestamp(value: Date) {\n this.timestamp = value;\n return this;\n }\n\n withLocale(value: string) {\n this.locale = value;\n return this;\n }\n\n withLocalTimestamp(value: Date) {\n this.localTimestamp = value;\n return this;\n }\n\n withChannelData(value: ChannelData) {\n this.channelData = { ...this.channelData, ...value };\n return this;\n }\n\n /**\n * Add an entity.\n */\n addEntity(value: Entity) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(value);\n return this;\n }\n\n /**\n * Add multiple entities\n */\n addEntities(...value: Entity[]) {\n if (!this.entities) {\n this.entities = [];\n }\n\n this.entities.push(...value);\n return this;\n }\n\n /**\n * Add the `Generated By AI` label.\n */\n addAiGenerated() {\n const messageEntity: AIMessageEntity = this.ensureSingleRootLevelMessageEntity();\n if (messageEntity.additionalType?.includes('AIGeneratedContent')) {\n return this;\n }\n\n if (!messageEntity.additionalType) {\n messageEntity.additionalType = [];\n }\n\n messageEntity.additionalType.push(`AIGeneratedContent`);\n return this;\n }\n\n /**\n * Enable message feedback\n */\n addFeedback() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.feedbackLoopEnabled = true;\n return this;\n }\n\n /**\n * Add citations\n */\n addCitation(position: number, appearance: CitationAppearance) {\n const messageEntity: CitationEntity = this.ensureSingleRootLevelMessageEntity();\n if (!messageEntity.citation) {\n messageEntity.citation = [];\n }\n\n messageEntity.citation.push({\n '@type': 'Claim',\n position,\n appearance: {\n '@type': 'DigitalDocument',\n abstract: appearance.abstract,\n name: appearance.name,\n encodingFormat: 'application/vnd.microsoft.card.adaptive',\n image: appearance.icon\n ? {\n '@type': 'ImageObject',\n name: appearance.icon,\n }\n : undefined,\n keywords: appearance.keywords,\n text: appearance.text,\n url: appearance.url,\n usageInfo: appearance.usageInfo,\n },\n });\n\n return this;\n }\n\n /**\n * is this a streaming activity\n */\n isStreaming() {\n return this.entities?.some((e) => e.type === 'streaminfo') || false;\n }\n\n /**\n * Get or create the base message entity.\n * There should only be one root level message entity.\n */\n private ensureSingleRootLevelMessageEntity(): MessageEntity {\n let mesageEntity = this.entities?.find(\n (e) => e.type === 'https://schema.org/Message' && e['@type'] === 'Message'\n ) as MessageEntity | undefined;\n\n if (!mesageEntity) {\n mesageEntity = {\n type: 'https://schema.org/Message',\n '@type': 'Message',\n '@context': 'https://schema.org',\n '@id': '',\n };\n this.addEntity(mesageEntity);\n }\n\n return mesageEntity;\n }\n}\n"]}
|
|
@@ -5,11 +5,11 @@ import '../../models/role.mjs';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.mjs';
|
|
6
6
|
import '../../models/entity/index.mjs';
|
|
7
7
|
import '../../models/entity/ai-message-entity.mjs';
|
|
8
|
+
import '../../models/entity/message-entity.mjs';
|
|
8
9
|
import '../../models/entity/citation-entity.mjs';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
10
10
|
import '../../models/entity/client-info-entity.mjs';
|
|
11
11
|
import '../../models/entity/mention-entity.mjs';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
13
13
|
import '../../models/entity/stream-info-entity.mjs';
|
|
14
14
|
import '../../models/channel-data/index.mjs';
|
|
15
15
|
import '../../models/meeting/meeting-info.mjs';
|
|
@@ -5,11 +5,11 @@ import '../../models/role.js';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.js';
|
|
6
6
|
import '../../models/entity/index.js';
|
|
7
7
|
import '../../models/entity/ai-message-entity.js';
|
|
8
|
+
import '../../models/entity/message-entity.js';
|
|
8
9
|
import '../../models/entity/citation-entity.js';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
10
10
|
import '../../models/entity/client-info-entity.js';
|
|
11
11
|
import '../../models/entity/mention-entity.js';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
13
13
|
import '../../models/entity/stream-info-entity.js';
|
|
14
14
|
import '../../models/channel-data/index.js';
|
|
15
15
|
import '../../models/meeting/meeting-info.js';
|
|
@@ -5,11 +5,11 @@ import '../../models/role.mjs';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.mjs';
|
|
6
6
|
import '../../models/entity/index.mjs';
|
|
7
7
|
import '../../models/entity/ai-message-entity.mjs';
|
|
8
|
+
import '../../models/entity/message-entity.mjs';
|
|
8
9
|
import '../../models/entity/citation-entity.mjs';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
10
10
|
import '../../models/entity/client-info-entity.mjs';
|
|
11
11
|
import '../../models/entity/mention-entity.mjs';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
13
13
|
import '../../models/entity/stream-info-entity.mjs';
|
|
14
14
|
import '../../models/channel-data/index.mjs';
|
|
15
15
|
import '../../models/meeting/meeting-info.mjs';
|
|
@@ -5,11 +5,11 @@ import '../../models/role.js';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.js';
|
|
6
6
|
import '../../models/entity/index.js';
|
|
7
7
|
import '../../models/entity/ai-message-entity.js';
|
|
8
|
+
import '../../models/entity/message-entity.js';
|
|
8
9
|
import '../../models/entity/citation-entity.js';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
10
10
|
import '../../models/entity/client-info-entity.js';
|
|
11
11
|
import '../../models/entity/mention-entity.js';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
13
13
|
import '../../models/entity/stream-info-entity.js';
|
|
14
14
|
import '../../models/channel-data/index.js';
|
|
15
15
|
import '../../models/meeting/meeting-info.js';
|
|
@@ -9,11 +9,11 @@ import '../../models/role.mjs';
|
|
|
9
9
|
import '../../models/conversation/conversation-reference.mjs';
|
|
10
10
|
import '../../models/entity/index.mjs';
|
|
11
11
|
import '../../models/entity/ai-message-entity.mjs';
|
|
12
|
+
import '../../models/entity/message-entity.mjs';
|
|
12
13
|
import '../../models/entity/citation-entity.mjs';
|
|
13
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
14
14
|
import '../../models/entity/client-info-entity.mjs';
|
|
15
15
|
import '../../models/entity/mention-entity.mjs';
|
|
16
|
-
import '../../models/entity/
|
|
16
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
17
17
|
import '../../models/entity/stream-info-entity.mjs';
|
|
18
18
|
import '../../models/channel-data/index.mjs';
|
|
19
19
|
import '../../models/meeting/meeting-info.mjs';
|
|
@@ -9,11 +9,11 @@ import '../../models/role.js';
|
|
|
9
9
|
import '../../models/conversation/conversation-reference.js';
|
|
10
10
|
import '../../models/entity/index.js';
|
|
11
11
|
import '../../models/entity/ai-message-entity.js';
|
|
12
|
+
import '../../models/entity/message-entity.js';
|
|
12
13
|
import '../../models/entity/citation-entity.js';
|
|
13
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
14
14
|
import '../../models/entity/client-info-entity.js';
|
|
15
15
|
import '../../models/entity/mention-entity.js';
|
|
16
|
-
import '../../models/entity/
|
|
16
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
17
17
|
import '../../models/entity/stream-info-entity.js';
|
|
18
18
|
import '../../models/channel-data/index.js';
|
|
19
19
|
import '../../models/meeting/meeting-info.js';
|
|
@@ -6,11 +6,11 @@ import '../../models/channel-id.mjs';
|
|
|
6
6
|
import '../../models/conversation/conversation-reference.mjs';
|
|
7
7
|
import '../../models/entity/index.mjs';
|
|
8
8
|
import '../../models/entity/ai-message-entity.mjs';
|
|
9
|
+
import '../../models/entity/message-entity.mjs';
|
|
9
10
|
import '../../models/entity/citation-entity.mjs';
|
|
10
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
11
11
|
import '../../models/entity/client-info-entity.mjs';
|
|
12
12
|
import '../../models/entity/mention-entity.mjs';
|
|
13
|
-
import '../../models/entity/
|
|
13
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
14
14
|
import '../../models/entity/stream-info-entity.mjs';
|
|
15
15
|
import '../../models/meeting/meeting-info.mjs';
|
|
16
16
|
import '../../models/meeting/meeting-details.mjs';
|
|
@@ -6,11 +6,11 @@ import '../../models/channel-id.js';
|
|
|
6
6
|
import '../../models/conversation/conversation-reference.js';
|
|
7
7
|
import '../../models/entity/index.js';
|
|
8
8
|
import '../../models/entity/ai-message-entity.js';
|
|
9
|
+
import '../../models/entity/message-entity.js';
|
|
9
10
|
import '../../models/entity/citation-entity.js';
|
|
10
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
11
11
|
import '../../models/entity/client-info-entity.js';
|
|
12
12
|
import '../../models/entity/mention-entity.js';
|
|
13
|
-
import '../../models/entity/
|
|
13
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
14
14
|
import '../../models/entity/stream-info-entity.js';
|
|
15
15
|
import '../../models/meeting/meeting-info.js';
|
|
16
16
|
import '../../models/meeting/meeting-details.js';
|
|
@@ -5,11 +5,11 @@ import '../../models/role.mjs';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.mjs';
|
|
6
6
|
import '../../models/entity/index.mjs';
|
|
7
7
|
import '../../models/entity/ai-message-entity.mjs';
|
|
8
|
+
import '../../models/entity/message-entity.mjs';
|
|
8
9
|
import '../../models/entity/citation-entity.mjs';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
10
10
|
import '../../models/entity/client-info-entity.mjs';
|
|
11
11
|
import '../../models/entity/mention-entity.mjs';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
13
13
|
import '../../models/entity/stream-info-entity.mjs';
|
|
14
14
|
import '../../models/channel-data/index.mjs';
|
|
15
15
|
import '../../models/meeting/meeting-info.mjs';
|
|
@@ -5,11 +5,11 @@ import '../../models/role.js';
|
|
|
5
5
|
import '../../models/conversation/conversation-reference.js';
|
|
6
6
|
import '../../models/entity/index.js';
|
|
7
7
|
import '../../models/entity/ai-message-entity.js';
|
|
8
|
+
import '../../models/entity/message-entity.js';
|
|
8
9
|
import '../../models/entity/citation-entity.js';
|
|
9
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
10
10
|
import '../../models/entity/client-info-entity.js';
|
|
11
11
|
import '../../models/entity/mention-entity.js';
|
|
12
|
-
import '../../models/entity/
|
|
12
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
13
13
|
import '../../models/entity/stream-info-entity.js';
|
|
14
14
|
import '../../models/channel-data/index.js';
|
|
15
15
|
import '../../models/meeting/meeting-info.js';
|
|
@@ -8,11 +8,11 @@ import '../../models/channel-id.mjs';
|
|
|
8
8
|
import '../../models/conversation/conversation-reference.mjs';
|
|
9
9
|
import '../../models/entity/index.mjs';
|
|
10
10
|
import '../../models/entity/ai-message-entity.mjs';
|
|
11
|
+
import '../../models/entity/message-entity.mjs';
|
|
11
12
|
import '../../models/entity/citation-entity.mjs';
|
|
12
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
13
13
|
import '../../models/entity/client-info-entity.mjs';
|
|
14
14
|
import '../../models/entity/mention-entity.mjs';
|
|
15
|
-
import '../../models/entity/
|
|
15
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
16
16
|
import '../../models/entity/stream-info-entity.mjs';
|
|
17
17
|
import '../../models/channel-data/index.mjs';
|
|
18
18
|
import '../../models/meeting/meeting-info.mjs';
|
|
@@ -8,11 +8,11 @@ import '../../models/channel-id.js';
|
|
|
8
8
|
import '../../models/conversation/conversation-reference.js';
|
|
9
9
|
import '../../models/entity/index.js';
|
|
10
10
|
import '../../models/entity/ai-message-entity.js';
|
|
11
|
+
import '../../models/entity/message-entity.js';
|
|
11
12
|
import '../../models/entity/citation-entity.js';
|
|
12
|
-
import '../../models/entity/sensitive-usage-entity.js';
|
|
13
13
|
import '../../models/entity/client-info-entity.js';
|
|
14
14
|
import '../../models/entity/mention-entity.js';
|
|
15
|
-
import '../../models/entity/
|
|
15
|
+
import '../../models/entity/sensitive-usage-entity.js';
|
|
16
16
|
import '../../models/entity/stream-info-entity.js';
|
|
17
17
|
import '../../models/channel-data/index.js';
|
|
18
18
|
import '../../models/meeting/meeting-info.js';
|
|
@@ -10,11 +10,11 @@ import '../../models/role.mjs';
|
|
|
10
10
|
import '../../models/conversation/conversation-reference.mjs';
|
|
11
11
|
import '../../models/entity/index.mjs';
|
|
12
12
|
import '../../models/entity/ai-message-entity.mjs';
|
|
13
|
+
import '../../models/entity/message-entity.mjs';
|
|
13
14
|
import '../../models/entity/citation-entity.mjs';
|
|
14
|
-
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
15
15
|
import '../../models/entity/client-info-entity.mjs';
|
|
16
16
|
import '../../models/entity/mention-entity.mjs';
|
|
17
|
-
import '../../models/entity/
|
|
17
|
+
import '../../models/entity/sensitive-usage-entity.mjs';
|
|
18
18
|
import '../../models/entity/stream-info-entity.mjs';
|
|
19
19
|
import '../../models/channel-data/index.mjs';
|
|
20
20
|
import '../../models/meeting/meeting-info.mjs';
|