@microsoft/teams.api 0.2.13 → 2.0.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/dist/activities/activity.js +1 -1
- package/dist/activities/activity.js.map +1 -1
- package/dist/activities/activity.mjs +1 -1
- package/dist/activities/activity.mjs.map +1 -1
- package/dist/activities/index.d.mts +1 -1
- package/dist/activities/index.d.ts +1 -1
- package/dist/activities/invoke/index.d.mts +1 -1
- package/dist/activities/invoke/index.d.ts +1 -1
- package/dist/activities/invoke/message-extension/fetch-task.d.mts +1 -1
- package/dist/activities/invoke/message-extension/fetch-task.d.ts +1 -1
- package/dist/activities/invoke/message-extension/index.d.mts +1 -1
- package/dist/activities/invoke/message-extension/index.d.ts +1 -1
- package/dist/activities/invoke/message-extension/submit-action.d.mts +1 -1
- package/dist/activities/invoke/message-extension/submit-action.d.ts +1 -1
- package/dist/activities/message/message.js.map +1 -1
- package/dist/activities/message/message.mjs.map +1 -1
- package/dist/activities/utils/index.d.mts +1 -1
- package/dist/activities/utils/index.d.ts +1 -1
- package/dist/activities/utils/to-activity-params.d.mts +1 -1
- package/dist/activities/utils/to-activity-params.d.ts +1 -1
- package/dist/activities/utils/to-activity-params.js +1 -1
- package/dist/activities/utils/to-activity-params.js.map +1 -1
- package/dist/activities/utils/to-activity-params.mjs +2 -2
- package/dist/activities/utils/to-activity-params.mjs.map +1 -1
- package/dist/{activity-BBGVkx41.d.ts → activity-CTQ0yu7i.d.ts} +2 -2
- package/dist/{activity-CszVnh5f.d.mts → activity-PjVFY4cx.d.mts} +2 -2
- 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 +1 -1
- package/dist/clients/conversation/activity.d.ts +1 -1
- 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 +1 -1
- package/dist/clients/conversation/index.d.ts +1 -1
- package/dist/clients/conversation/index.js.map +1 -1
- package/dist/clients/conversation/index.mjs.map +1 -1
- package/dist/clients/index.d.mts +1 -1
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js.map +1 -1
- 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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/models/activity-like.d.mts +1 -1
- package/dist/models/activity-like.d.ts +1 -1
- package/dist/models/adaptive-card/adaptive-card-action-response.d.mts +2 -2
- package/dist/models/adaptive-card/adaptive-card-action-response.d.ts +2 -2
- package/dist/models/attachment/card-attachment.d.mts +2 -2
- package/dist/models/attachment/card-attachment.d.ts +2 -2
- package/dist/models/attachment/card-attachment.js.map +1 -1
- package/dist/models/attachment/card-attachment.mjs.map +1 -1
- package/dist/models/index.d.mts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/models/invoke-response.d.mts +1 -1
- package/dist/models/invoke-response.d.ts +1 -1
- package/dist/models/messaging-extension/index.d.mts +1 -1
- package/dist/models/messaging-extension/index.d.ts +1 -1
- package/dist/models/messaging-extension/messaging-extension-action-response.d.mts +1 -1
- package/dist/models/messaging-extension/messaging-extension-action-response.d.ts +1 -1
- package/dist/models/messaging-extension/messaging-extension-action.d.mts +1 -1
- package/dist/models/messaging-extension/messaging-extension-action.d.ts +1 -1
- package/dist/models/messaging-extension/messaging-extension-response.d.mts +1 -1
- package/dist/models/messaging-extension/messaging-extension-response.d.ts +1 -1
- package/dist/models/messaging-extension/messaging-extension-result.d.mts +1 -1
- package/dist/models/messaging-extension/messaging-extension-result.d.ts +1 -1
- package/dist/models/task-module/index.d.mts +1 -1
- package/dist/models/task-module/index.d.ts +1 -1
- package/dist/models/task-module/task-module-task-info.d.mts +34 -14
- package/dist/models/task-module/task-module-task-info.d.ts +34 -14
- package/package.json +5 -6
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
|
-
- [`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)
|
|
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)
|
|
@@ -190,7 +190,7 @@ class Activity {
|
|
|
190
190
|
if (!messageEntity.additionalType) {
|
|
191
191
|
messageEntity.additionalType = [];
|
|
192
192
|
}
|
|
193
|
-
messageEntity.additionalType.push(
|
|
193
|
+
messageEntity.additionalType.push("AIGeneratedContent");
|
|
194
194
|
return this;
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
@@ -1 +1 @@
|
|
|
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;AAAA;AAAA,EAKA,IAAI,OAAU,GAAA;AACZ,IAAA,OAAO,KAAK,WAAa,EAAA,OAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,IAAI,YAAe,GAAA;AACjB,I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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"]}
|
|
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;AAAA;AAAA,EAKA,IAAI,OAAU,GAAA;AACZ,IAAA,OAAO,KAAK,WAAa,EAAA,OAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,IAAI,YAAe,GAAA;AACjB,IAAA,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,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"]}
|
|
@@ -188,7 +188,7 @@ class Activity {
|
|
|
188
188
|
if (!messageEntity.additionalType) {
|
|
189
189
|
messageEntity.additionalType = [];
|
|
190
190
|
}
|
|
191
|
-
messageEntity.additionalType.push(
|
|
191
|
+
messageEntity.additionalType.push("AIGeneratedContent");
|
|
192
192
|
return this;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
@@ -1 +1 @@
|
|
|
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,EAK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B,MAAM,UAAW,CAAA,IAAA;AAAA,QACjB,KAAK,UAAW,CAAA,GAAA;AAAA,QAChB,WAAW,UAAW,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.mjs","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"]}
|
|
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,I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AAA,IAAA;AAAA,QACjB,KAAK,UAAW,CAAA,GAAA;AAAA,QAChB,WAAW,UAAW,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.mjs","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"]}
|
|
@@ -3,7 +3,7 @@ export { ConversationActivity } from './conversation/index.mjs';
|
|
|
3
3
|
export { EventActivity } from './event/index.mjs';
|
|
4
4
|
export { IHandoffActivity } from './handoff.mjs';
|
|
5
5
|
export { InstallUpdateActivity } from './install-update/index.mjs';
|
|
6
|
-
export { b as Activity, d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity, t as toActivityParams } from '../activity-
|
|
6
|
+
export { b as Activity, d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity, t as toActivityParams } from '../activity-PjVFY4cx.mjs';
|
|
7
7
|
export { $MessageActivity } from './message/index.mjs';
|
|
8
8
|
export { ITraceActivity } from './trace.mjs';
|
|
9
9
|
export { ITypingActivity, TypingActivity } from './typing.mjs';
|
|
@@ -3,7 +3,7 @@ export { ConversationActivity } from './conversation/index.js';
|
|
|
3
3
|
export { EventActivity } from './event/index.js';
|
|
4
4
|
export { IHandoffActivity } from './handoff.js';
|
|
5
5
|
export { InstallUpdateActivity } from './install-update/index.js';
|
|
6
|
-
export { b as Activity, d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity, t as toActivityParams } from '../activity-
|
|
6
|
+
export { b as Activity, d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity, t as toActivityParams } from '../activity-CTQ0yu7i.js';
|
|
7
7
|
export { $MessageActivity } from './message/index.js';
|
|
8
8
|
export { ITraceActivity } from './trace.js';
|
|
9
9
|
export { ITypingActivity, TypingActivity } from './typing.js';
|
|
@@ -4,7 +4,7 @@ export { IExecuteActionInvokeActivity } from './execute-action.mjs';
|
|
|
4
4
|
export { IFileConsentInvokeActivity } from './file-consent.mjs';
|
|
5
5
|
export { IHandoffActionInvokeActivity } from './handoff-action.mjs';
|
|
6
6
|
export { MessageInvokeActivity } from './message/index.mjs';
|
|
7
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity } from '../../activity-
|
|
7
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity } from '../../activity-PjVFY4cx.mjs';
|
|
8
8
|
export { SignInInvokeActivity } from './sign-in/index.mjs';
|
|
9
9
|
export { TabInvokeActivity } from './tab/index.mjs';
|
|
10
10
|
export { TaskInvokeActivity } from './task/index.mjs';
|
|
@@ -4,7 +4,7 @@ export { IExecuteActionInvokeActivity } from './execute-action.js';
|
|
|
4
4
|
export { IFileConsentInvokeActivity } from './file-consent.js';
|
|
5
5
|
export { IHandoffActionInvokeActivity } from './handoff-action.js';
|
|
6
6
|
export { MessageInvokeActivity } from './message/index.js';
|
|
7
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity } from '../../activity-
|
|
7
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, I as InvokeActivity, c as MessageExtensionInvokeActivity } from '../../activity-CTQ0yu7i.js';
|
|
8
8
|
export { SignInInvokeActivity } from './sign-in/index.js';
|
|
9
9
|
export { TabInvokeActivity } from './tab/index.js';
|
|
10
10
|
export { TaskInvokeActivity } from './task/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../models/conversation/conversation-reference.mjs';
|
|
2
2
|
import '../../activity.mjs';
|
|
3
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity } from '../../../activity-
|
|
3
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity } from '../../../activity-PjVFY4cx.mjs';
|
|
4
4
|
import '../../../models/account.mjs';
|
|
5
5
|
import '../../../models/role.mjs';
|
|
6
6
|
import '../../../models/channel-id.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../models/conversation/conversation-reference.js';
|
|
2
2
|
import '../../activity.js';
|
|
3
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity } from '../../../activity-
|
|
3
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity } from '../../../activity-CTQ0yu7i.js';
|
|
4
4
|
import '../../../models/account.js';
|
|
5
5
|
import '../../../models/role.js';
|
|
6
6
|
import '../../../models/channel-id.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IMessageExtensionAnonQueryLinkInvokeActivity } from './anon-query-link.mjs';
|
|
2
2
|
export { IMessageExtensionCardButtonClickedInvokeActivity } from './card-button-clicked.mjs';
|
|
3
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, c as MessageExtensionInvokeActivity } from '../../../activity-
|
|
3
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, c as MessageExtensionInvokeActivity } from '../../../activity-PjVFY4cx.mjs';
|
|
4
4
|
export { IMessageExtensionQueryInvokeActivity } from './query.mjs';
|
|
5
5
|
export { IMessageExtensionQueryLinkInvokeActivity } from './query-link.mjs';
|
|
6
6
|
export { IMessageExtensionQuerySettingUrlInvokeActivity } from './query-setting-url.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IMessageExtensionAnonQueryLinkInvokeActivity } from './anon-query-link.js';
|
|
2
2
|
export { IMessageExtensionCardButtonClickedInvokeActivity } from './card-button-clicked.js';
|
|
3
|
-
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, c as MessageExtensionInvokeActivity } from '../../../activity-
|
|
3
|
+
export { d as IMessageExtensionFetchTaskInvokeActivity, e as IMessageExtensionSubmitActionInvokeActivity, c as MessageExtensionInvokeActivity } from '../../../activity-CTQ0yu7i.js';
|
|
4
4
|
export { IMessageExtensionQueryInvokeActivity } from './query.js';
|
|
5
5
|
export { IMessageExtensionQueryLinkInvokeActivity } from './query-link.js';
|
|
6
6
|
export { IMessageExtensionQuerySettingUrlInvokeActivity } from './query-setting-url.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../models/conversation/conversation-reference.mjs';
|
|
2
2
|
import '../../activity.mjs';
|
|
3
|
-
export { e as IMessageExtensionSubmitActionInvokeActivity } from '../../../activity-
|
|
3
|
+
export { e as IMessageExtensionSubmitActionInvokeActivity } from '../../../activity-PjVFY4cx.mjs';
|
|
4
4
|
import '../../../models/account.mjs';
|
|
5
5
|
import '../../../models/role.mjs';
|
|
6
6
|
import '../../../models/channel-id.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../models/conversation/conversation-reference.js';
|
|
2
2
|
import '../../activity.js';
|
|
3
|
-
export { e as IMessageExtensionSubmitActionInvokeActivity } from '../../../activity-
|
|
3
|
+
export { e as IMessageExtensionSubmitActionInvokeActivity } from '../../../activity-CTQ0yu7i.js';
|
|
4
4
|
import '../../../models/account.js';
|
|
5
5
|
import '../../../models/role.js';
|
|
6
6
|
import '../../../models/channel-id.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/activities/message/message.ts"],"names":["Activ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A;AAAA;AAC1D;AAAA;AAAA;AAAA,EAKA,iBAAA,CAAkB,OAAoC,GAAA,EAAI,EAAA;AACxD,IAAK,IAAA,CAAA,IAAA,GAAOC,uBAAkB,CAAA,IAAA,EAAM,OAAO,CAAA;AAC3C,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA,EAKA,oBAAuB,GAAA;AACrB,IAAA,OAAA,CAAQ,KAAK,QAAY,IAAA,IACtB,MAAO,CAAA,CAAC,MAAM,CAAE,CAAA,IAAA,KAAS,SAAS,CAClC,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,CAAA,CAAE,UAAU,EAAO,KAAA,IAAA,CAAK,UAAU,EAAE,CAAA;AAAA;AACrD;AAAA;AAAA;AAAA,EAKA,kBAAkB,SAAmB,EAAA;AACnC,IAAA,OAAA,CAAQ,KAAK,QAAY,IAAA,EACtB,EAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,SAAS,EAClC,IAAK,CAAA,CAAC,MAAM,CAAE,CAAA,SAAA,CAAU,OAAO,SAAS,CAAA;AAAA;AAC7C;AAAA;AAAA;AAAA;AAAA,EAMA,cAAiB,GAAA;AACf,IAAI,IAAA,CAAC,KAAK,WAAa,EAAA;AACrB,MAAA,IAAA,CAAK,cAAc,EAAC;AAAA;AAGtB,IAAK,IAAA,CAAA,WAAA,CAAY,WAAW,IAAK,CAAA,EAAA;AACjC,IAAA,IAAA,CAAK,YAAY,UAAa,GAAA,OAAA;AAE9B,IAAA,OAAO,KAAK,SAAU,CAAA;AAAA,MACpB,IAAM,EAAA,YAAA;AAAA,MACN,UAAU,IAAK,CAAA,EAAA;AAAA,MACf,UAAY,EAAA;AAAA,KACb,CAAA;AAAA;AAEL","file":"message.js","sourcesContent":["import {\r\n Account,\r\n Attachment,\r\n AttachmentLayout,\r\n cardAttachment,\r\n CardAttachmentType,\r\n CardAttachmentTypes,\r\n DeliveryMode,\r\n Importance,\r\n InputHint,\r\n MentionEntity,\r\n SuggestedActions,\r\n TextFormat,\r\n} from '../../models';\r\nimport { IActivity, Activity } from '../activity';\r\nimport { stripMentionsText, StripMentionsTextOptions } from '../utils';\r\n\r\nexport interface IMessageActivity extends IActivity<'message'> {\r\n /**\r\n * The text content of the message.\r\n */\r\n text: string;\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n speak?: string;\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n inputHint?: InputHint;\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n summary?: string;\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n textFormat?: TextFormat;\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n attachmentLayout?: AttachmentLayout;\r\n\r\n /**\r\n * Attachments\r\n */\r\n attachments?: Attachment[];\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n suggestedActions?: SuggestedActions;\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n importance?: Importance;\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n deliveryMode?: DeliveryMode;\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n expiration?: Date;\r\n\r\n /**\r\n * A value that is associated with the activity.\r\n */\r\n value?: any;\r\n\r\n /**\r\n * remove \"\\<at>...\\</at>\" text from an activity\r\n */\r\n stripMentionsText(options?: StripMentionsTextOptions): IMessageActivity;\r\n\r\n /**\r\n * is the recipient account mentioned\r\n */\r\n isRecipientMentioned(): boolean;\r\n\r\n /**\r\n * get a mention by the account id if exists\r\n */\r\n getAccountMention(accountId: string): MentionEntity | undefined;\r\n}\r\n\r\nexport class MessageActivity extends Activity<'message'> implements IMessageActivity {\r\n /**\r\n * The text content of the message.\r\n */\r\n text!: string;\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n speak?: string;\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n inputHint?: InputHint;\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n summary?: string;\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n textFormat?: TextFormat;\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n attachmentLayout?: AttachmentLayout;\r\n\r\n /**\r\n * Attachments\r\n */\r\n attachments?: Attachment[];\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n suggestedActions?: SuggestedActions;\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n importance?: Importance;\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n deliveryMode?: DeliveryMode;\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n expiration?: Date;\r\n\r\n /**\r\n * A value that is associated with the activity.\r\n */\r\n value?: any;\r\n\r\n constructor(text: string = '', value: Omit<Partial<IMessageActivity>, 'type'> = {}) {\r\n super({\r\n ...value,\r\n type: 'message',\r\n });\r\n\r\n Object.assign(this, { text, ...value });\r\n }\r\n\r\n /**\r\n * initialize from interface\r\n */\r\n static from(activity: IMessageActivity) {\r\n return new MessageActivity(activity.text, activity);\r\n }\r\n\r\n /**\r\n * convert to interface\r\n */\r\n toInterface(): IMessageActivity {\r\n return Object.assign(\r\n {\r\n stripMentionsText: this.stripMentionsText.bind(this),\r\n isRecipientMentioned: this.isRecipientMentioned.bind(this),\r\n getAccountMention: this.getAccountMention.bind(this),\r\n },\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * copy to a new instance\r\n */\r\n clone(options: Omit<Partial<IMessageActivity>, 'type'> = {}) {\r\n return new MessageActivity(this.text, {\r\n ...this.toInterface(),\r\n ...options,\r\n });\r\n }\r\n\r\n /**\r\n * The text content of the message.\r\n */\r\n withText(value: string) {\r\n this.text = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n withSpeak(value: string) {\r\n this.speak = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n withInputHint(value: InputHint) {\r\n this.inputHint = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n withSummary(value: string) {\r\n this.summary = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n withTextFormat(value: TextFormat) {\r\n this.textFormat = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n withAttachmentLayout(value: AttachmentLayout) {\r\n this.attachmentLayout = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n withSuggestedActions(value: SuggestedActions) {\r\n this.suggestedActions = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n withImportance(value: Importance) {\r\n this.importance = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n withDeliveryMode(value: DeliveryMode) {\r\n this.deliveryMode = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n withExpiration(value: Date) {\r\n this.expiration = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Append text\r\n */\r\n addText(text: string) {\r\n this.text += text;\r\n return this;\r\n }\r\n\r\n /**\r\n * Attachments\r\n */\r\n addAttachments(...value: Attachment[]) {\r\n if (!this.attachments) {\r\n this.attachments = [];\r\n }\r\n\r\n this.attachments.push(...value);\r\n return this;\r\n }\r\n\r\n /**\r\n * `@mention` an account\r\n * @param account the account to mention\r\n * @param options options to customize the mention\r\n */\r\n addMention(account: Account, options: AddMentionOptions = {}) {\r\n const text = options.text || account.name;\r\n const addText = options.addText || true;\r\n\r\n if (addText) {\r\n this.addText(`<at>${text}</at>`);\r\n }\r\n\r\n return this.addEntity({\r\n type: 'mention',\r\n mentioned: account,\r\n text: `<at>${text}</at>`,\r\n });\r\n }\r\n\r\n /**\r\n * Add a card attachment\r\n */\r\n addCard<T extends CardAttachmentType>(type: T, content: CardAttachmentTypes[T]['content']) {\r\n return this.addAttachments(cardAttachment(type, content));\r\n }\r\n\r\n /**\r\n * remove \"\\<at>...\\</at>\" text from an activity\r\n */\r\n stripMentionsText(options: StripMentionsTextOptions = {}) {\r\n this.text = stripMentionsText(this, options);\r\n return this;\r\n }\r\n\r\n /**\r\n * is the recipient account mentioned\r\n */\r\n isRecipientMentioned() {\r\n return (this.entities || [])\r\n .filter((e) => e.type === 'mention')\r\n .some((e) => e.mentioned.id === this.recipient.id);\r\n }\r\n\r\n /**\r\n * get a mention by the account id if exists\r\n */\r\n getAccountMention(accountId: string) {\r\n return (this.entities || [])\r\n .filter((e) => e.type === 'mention')\r\n .find((e) => e.mentioned.id === accountId);\r\n }\r\n\r\n /**\r\n * Add stream info, making\r\n * this a final stream message\r\n */\r\n addStreamFinal() {\r\n if (!this.channelData) {\r\n this.channelData = {};\r\n }\r\n\r\n this.channelData.streamId = this.id;\r\n this.channelData.streamType = 'final';\r\n\r\n return this.addEntity({\r\n type: 'streaminfo',\r\n streamId: this.id,\r\n streamType: 'final',\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * options for adding a mention\r\n * to an activity\r\n */\r\nexport type AddMentionOptions = {\r\n /**\r\n * if `true`, append the mention `text` to the `activity.text`\r\n * @default true\r\n */\r\n readonly addText?: boolean;\r\n\r\n /**\r\n * the `text` to use for the mention\r\n *\r\n * @default `account.name`\r\n * @remark\r\n * this text should not include `<at>` or `</at>`\r\n */\r\n readonly text?: string;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/activities/message/message.ts"],"names":["Activity","cardAttachment","stripMentionsText"],"mappings":";;;;;;AAmGO,MAAM,wBAAwBA,iBAAgD,CAAA;AAAA;AAAA;AAAA;AAAA,EAInF,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA,EAEA,WAAY,CAAA,IAAA,GAAe,EAAI,EAAA,KAAA,GAAiD,EAAI,EAAA;AAClF,IAAM,KAAA,CAAA;AAAA,MACJ,GAAG,KAAA;AAAA,MACH,IAAM,EAAA;AAAA,KACP,CAAA;AAED,IAAA,MAAA,CAAO,OAAO,IAAM,EAAA,EAAE,IAAM,EAAA,GAAG,OAAO,CAAA;AAAA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rB,MAAA,IAAA,CAAK,cAAc,EAAC;AAAA;AAGtB,IAAK,IAAA,CAAA,WAAA,CAAY,WAAW,IAAK,CAAA,EAAA;AACjC,IAAA,IAAA,CAAK,YAAY,UAAa,GAAA,OAAA;AAE9B,IAAA,OAAO,KAAK,SAAU,CAAA;AAAA,MACpB,IAAM,EAAA,YAAA;AAAA,MACN,UAAU,IAAK,CAAA,EAAA;AAAA,MACf,UAAY,EAAA;AAAA,KACb,CAAA;AAAA;AAEL","file":"message.js","sourcesContent":["import {\n Account,\n Attachment,\n AttachmentLayout,\n cardAttachment,\n CardAttachmentType,\n CardAttachmentTypes,\n DeliveryMode,\n Importance,\n InputHint,\n MentionEntity,\n SuggestedActions,\n TextFormat,\n} from '../../models';\nimport { IActivity, Activity } from '../activity';\nimport { stripMentionsText, StripMentionsTextOptions } from '../utils';\n\nexport interface IMessageActivity extends IActivity<'message'> {\n /**\n * The text content of the message.\n */\n text: string;\n\n /**\n * The text to speak.\n */\n speak?: string;\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n inputHint?: InputHint;\n\n /**\n * The text to display if the channel cannot render cards.\n */\n summary?: string;\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n textFormat?: TextFormat;\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n attachmentLayout?: AttachmentLayout;\n\n /**\n * Attachments\n */\n attachments?: Attachment[];\n\n /**\n * The suggested actions for the activity.\n */\n suggestedActions?: SuggestedActions;\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n importance?: Importance;\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n deliveryMode?: DeliveryMode;\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n expiration?: Date;\n\n /**\n * A value that is associated with the activity.\n */\n value?: any;\n\n /**\n * remove \"\\<at>...\\</at>\" text from an activity\n */\n stripMentionsText(options?: StripMentionsTextOptions): IMessageActivity;\n\n /**\n * is the recipient account mentioned\n */\n isRecipientMentioned(): boolean;\n\n /**\n * get a mention by the account id if exists\n */\n getAccountMention(accountId: string): MentionEntity | undefined;\n}\n\nexport class MessageActivity extends Activity<'message'> implements IMessageActivity {\n /**\n * The text content of the message.\n */\n text!: string;\n\n /**\n * The text to speak.\n */\n speak?: string;\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n inputHint?: InputHint;\n\n /**\n * The text to display if the channel cannot render cards.\n */\n summary?: string;\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n textFormat?: TextFormat;\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n attachmentLayout?: AttachmentLayout;\n\n /**\n * Attachments\n */\n attachments?: Attachment[];\n\n /**\n * The suggested actions for the activity.\n */\n suggestedActions?: SuggestedActions;\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n importance?: Importance;\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n deliveryMode?: DeliveryMode;\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n expiration?: Date;\n\n /**\n * A value that is associated with the activity.\n */\n value?: any;\n\n constructor(text: string = '', value: Omit<Partial<IMessageActivity>, 'type'> = {}) {\n super({\n ...value,\n type: 'message',\n });\n\n Object.assign(this, { text, ...value });\n }\n\n /**\n * initialize from interface\n */\n static from(activity: IMessageActivity) {\n return new MessageActivity(activity.text, activity);\n }\n\n /**\n * convert to interface\n */\n toInterface(): IMessageActivity {\n return Object.assign(\n {\n stripMentionsText: this.stripMentionsText.bind(this),\n isRecipientMentioned: this.isRecipientMentioned.bind(this),\n getAccountMention: this.getAccountMention.bind(this),\n },\n this\n );\n }\n\n /**\n * copy to a new instance\n */\n clone(options: Omit<Partial<IMessageActivity>, 'type'> = {}) {\n return new MessageActivity(this.text, {\n ...this.toInterface(),\n ...options,\n });\n }\n\n /**\n * The text content of the message.\n */\n withText(value: string) {\n this.text = value;\n return this;\n }\n\n /**\n * The text to speak.\n */\n withSpeak(value: string) {\n this.speak = value;\n return this;\n }\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n withInputHint(value: InputHint) {\n this.inputHint = value;\n return this;\n }\n\n /**\n * The text to display if the channel cannot render cards.\n */\n withSummary(value: string) {\n this.summary = value;\n return this;\n }\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n withTextFormat(value: TextFormat) {\n this.textFormat = value;\n return this;\n }\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n withAttachmentLayout(value: AttachmentLayout) {\n this.attachmentLayout = value;\n return this;\n }\n\n /**\n * The suggested actions for the activity.\n */\n withSuggestedActions(value: SuggestedActions) {\n this.suggestedActions = value;\n return this;\n }\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n withImportance(value: Importance) {\n this.importance = value;\n return this;\n }\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n withDeliveryMode(value: DeliveryMode) {\n this.deliveryMode = value;\n return this;\n }\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n withExpiration(value: Date) {\n this.expiration = value;\n return this;\n }\n\n /**\n * Append text\n */\n addText(text: string) {\n this.text += text;\n return this;\n }\n\n /**\n * Attachments\n */\n addAttachments(...value: Attachment[]) {\n if (!this.attachments) {\n this.attachments = [];\n }\n\n this.attachments.push(...value);\n return this;\n }\n\n /**\n * `@mention` an account\n * @param account the account to mention\n * @param options options to customize the mention\n */\n addMention(account: Account, options: AddMentionOptions = {}) {\n const text = options.text || account.name;\n const addText = options.addText || true;\n\n if (addText) {\n this.addText(`<at>${text}</at>`);\n }\n\n return this.addEntity({\n type: 'mention',\n mentioned: account,\n text: `<at>${text}</at>`,\n });\n }\n\n /**\n * Add a card attachment\n */\n addCard<T extends CardAttachmentType>(type: T, content: CardAttachmentTypes[T]['content']) {\n return this.addAttachments(cardAttachment(type, content));\n }\n\n /**\n * remove \"\\<at>...\\</at>\" text from an activity\n */\n stripMentionsText(options: StripMentionsTextOptions = {}) {\n this.text = stripMentionsText(this, options);\n return this;\n }\n\n /**\n * is the recipient account mentioned\n */\n isRecipientMentioned() {\n return (this.entities || [])\n .filter((e) => e.type === 'mention')\n .some((e) => e.mentioned.id === this.recipient.id);\n }\n\n /**\n * get a mention by the account id if exists\n */\n getAccountMention(accountId: string) {\n return (this.entities || [])\n .filter((e) => e.type === 'mention')\n .find((e) => e.mentioned.id === accountId);\n }\n\n /**\n * Add stream info, making\n * this a final stream message\n */\n addStreamFinal() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.streamId = this.id;\n this.channelData.streamType = 'final';\n\n return this.addEntity({\n type: 'streaminfo',\n streamId: this.id,\n streamType: 'final',\n });\n }\n}\n\n/**\n * options for adding a mention\n * to an activity\n */\nexport type AddMentionOptions = {\n /**\n * if `true`, append the mention `text` to the `activity.text`\n * @default true\n */\n readonly addText?: boolean;\n\n /**\n * the `text` to use for the mention\n *\n * @default `account.name`\n * @remark\n * this text should not include `<at>` or `</at>`\n */\n readonly text?: string;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/activities/message/message.ts"],"names":[],"mappings":";;;;AAmGO,MAAM,wBAAwB,QAAgD,CAAA;A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AA;AACxD,IAAK,IAAA,CAAA,IAAA,GAAO,iBAAkB,CAAA,IAAA,EAAM,OAAO,CAAA;AAC3C,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA,EAKA,oBAAuB,GAAA;AACrB,IAAA,OAAA,CAAQ,KAAK,QAAY,IAAA,IACtB,MAAO,CAAA,CAAC,MAAM,CAAE,CAAA,IAAA,KAAS,SAAS,CAClC,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,CAAA,CAAE,UAAU,EAAO,KAAA,IAAA,CAAK,UAAU,EAAE,CAAA;AAAA;AACrD;AAAA;AAAA;AAAA,EAKA,kBAAkB,SAAmB,EAAA;AACnC,IAAA,OAAA,CAAQ,KAAK,QAAY,IAAA,EACtB,EAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,SAAS,EAClC,IAAK,CAAA,CAAC,MAAM,CAAE,CAAA,SAAA,CAAU,OAAO,SAAS,CAAA;AAAA;AAC7C;AAAA;AAAA;AAAA;AAAA,EAMA,cAAiB,GAAA;AACf,IAAI,IAAA,CAAC,KAAK,WAAa,EAAA;AACrB,MAAA,IAAA,CAAK,cAAc,EAAC;AAAA;AAGtB,IAAK,IAAA,CAAA,WAAA,CAAY,WAAW,IAAK,CAAA,EAAA;AACjC,IAAA,IAAA,CAAK,YAAY,UAAa,GAAA,OAAA;AAE9B,IAAA,OAAO,KAAK,SAAU,CAAA;AAAA,MACpB,IAAM,EAAA,YAAA;AAAA,MACN,UAAU,IAAK,CAAA,EAAA;AAAA,MACf,UAAY,EAAA;AAAA,KACb,CAAA;AAAA;AAEL","file":"message.mjs","sourcesContent":["import {\r\n Account,\r\n Attachment,\r\n AttachmentLayout,\r\n cardAttachment,\r\n CardAttachmentType,\r\n CardAttachmentTypes,\r\n DeliveryMode,\r\n Importance,\r\n InputHint,\r\n MentionEntity,\r\n SuggestedActions,\r\n TextFormat,\r\n} from '../../models';\r\nimport { IActivity, Activity } from '../activity';\r\nimport { stripMentionsText, StripMentionsTextOptions } from '../utils';\r\n\r\nexport interface IMessageActivity extends IActivity<'message'> {\r\n /**\r\n * The text content of the message.\r\n */\r\n text: string;\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n speak?: string;\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n inputHint?: InputHint;\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n summary?: string;\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n textFormat?: TextFormat;\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n attachmentLayout?: AttachmentLayout;\r\n\r\n /**\r\n * Attachments\r\n */\r\n attachments?: Attachment[];\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n suggestedActions?: SuggestedActions;\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n importance?: Importance;\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n deliveryMode?: DeliveryMode;\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n expiration?: Date;\r\n\r\n /**\r\n * A value that is associated with the activity.\r\n */\r\n value?: any;\r\n\r\n /**\r\n * remove \"\\<at>...\\</at>\" text from an activity\r\n */\r\n stripMentionsText(options?: StripMentionsTextOptions): IMessageActivity;\r\n\r\n /**\r\n * is the recipient account mentioned\r\n */\r\n isRecipientMentioned(): boolean;\r\n\r\n /**\r\n * get a mention by the account id if exists\r\n */\r\n getAccountMention(accountId: string): MentionEntity | undefined;\r\n}\r\n\r\nexport class MessageActivity extends Activity<'message'> implements IMessageActivity {\r\n /**\r\n * The text content of the message.\r\n */\r\n text!: string;\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n speak?: string;\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n inputHint?: InputHint;\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n summary?: string;\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n textFormat?: TextFormat;\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n attachmentLayout?: AttachmentLayout;\r\n\r\n /**\r\n * Attachments\r\n */\r\n attachments?: Attachment[];\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n suggestedActions?: SuggestedActions;\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n importance?: Importance;\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n deliveryMode?: DeliveryMode;\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n expiration?: Date;\r\n\r\n /**\r\n * A value that is associated with the activity.\r\n */\r\n value?: any;\r\n\r\n constructor(text: string = '', value: Omit<Partial<IMessageActivity>, 'type'> = {}) {\r\n super({\r\n ...value,\r\n type: 'message',\r\n });\r\n\r\n Object.assign(this, { text, ...value });\r\n }\r\n\r\n /**\r\n * initialize from interface\r\n */\r\n static from(activity: IMessageActivity) {\r\n return new MessageActivity(activity.text, activity);\r\n }\r\n\r\n /**\r\n * convert to interface\r\n */\r\n toInterface(): IMessageActivity {\r\n return Object.assign(\r\n {\r\n stripMentionsText: this.stripMentionsText.bind(this),\r\n isRecipientMentioned: this.isRecipientMentioned.bind(this),\r\n getAccountMention: this.getAccountMention.bind(this),\r\n },\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * copy to a new instance\r\n */\r\n clone(options: Omit<Partial<IMessageActivity>, 'type'> = {}) {\r\n return new MessageActivity(this.text, {\r\n ...this.toInterface(),\r\n ...options,\r\n });\r\n }\r\n\r\n /**\r\n * The text content of the message.\r\n */\r\n withText(value: string) {\r\n this.text = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The text to speak.\r\n */\r\n withSpeak(value: string) {\r\n this.speak = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Indicates whether your bot is accepting,\r\n * expecting, or ignoring user input after the message is delivered to the client. Possible\r\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\r\n */\r\n withInputHint(value: InputHint) {\r\n this.inputHint = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The text to display if the channel cannot render cards.\r\n */\r\n withSummary(value: string) {\r\n this.summary = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\r\n */\r\n withTextFormat(value: TextFormat) {\r\n this.textFormat = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\r\n * 'carousel'\r\n */\r\n withAttachmentLayout(value: AttachmentLayout) {\r\n this.attachmentLayout = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The suggested actions for the activity.\r\n */\r\n withSuggestedActions(value: SuggestedActions) {\r\n this.suggestedActions = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\r\n */\r\n withImportance(value: Importance) {\r\n this.importance = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\r\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\r\n */\r\n withDeliveryMode(value: DeliveryMode) {\r\n this.deliveryMode = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * The time at which the activity should be considered to be \"expired\" and should not be\r\n * presented to the recipient.\r\n */\r\n withExpiration(value: Date) {\r\n this.expiration = value;\r\n return this;\r\n }\r\n\r\n /**\r\n * Append text\r\n */\r\n addText(text: string) {\r\n this.text += text;\r\n return this;\r\n }\r\n\r\n /**\r\n * Attachments\r\n */\r\n addAttachments(...value: Attachment[]) {\r\n if (!this.attachments) {\r\n this.attachments = [];\r\n }\r\n\r\n this.attachments.push(...value);\r\n return this;\r\n }\r\n\r\n /**\r\n * `@mention` an account\r\n * @param account the account to mention\r\n * @param options options to customize the mention\r\n */\r\n addMention(account: Account, options: AddMentionOptions = {}) {\r\n const text = options.text || account.name;\r\n const addText = options.addText || true;\r\n\r\n if (addText) {\r\n this.addText(`<at>${text}</at>`);\r\n }\r\n\r\n return this.addEntity({\r\n type: 'mention',\r\n mentioned: account,\r\n text: `<at>${text}</at>`,\r\n });\r\n }\r\n\r\n /**\r\n * Add a card attachment\r\n */\r\n addCard<T extends CardAttachmentType>(type: T, content: CardAttachmentTypes[T]['content']) {\r\n return this.addAttachments(cardAttachment(type, content));\r\n }\r\n\r\n /**\r\n * remove \"\\<at>...\\</at>\" text from an activity\r\n */\r\n stripMentionsText(options: StripMentionsTextOptions = {}) {\r\n this.text = stripMentionsText(this, options);\r\n return this;\r\n }\r\n\r\n /**\r\n * is the recipient account mentioned\r\n */\r\n isRecipientMentioned() {\r\n return (this.entities || [])\r\n .filter((e) => e.type === 'mention')\r\n .some((e) => e.mentioned.id === this.recipient.id);\r\n }\r\n\r\n /**\r\n * get a mention by the account id if exists\r\n */\r\n getAccountMention(accountId: string) {\r\n return (this.entities || [])\r\n .filter((e) => e.type === 'mention')\r\n .find((e) => e.mentioned.id === accountId);\r\n }\r\n\r\n /**\r\n * Add stream info, making\r\n * this a final stream message\r\n */\r\n addStreamFinal() {\r\n if (!this.channelData) {\r\n this.channelData = {};\r\n }\r\n\r\n this.channelData.streamId = this.id;\r\n this.channelData.streamType = 'final';\r\n\r\n return this.addEntity({\r\n type: 'streaminfo',\r\n streamId: this.id,\r\n streamType: 'final',\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * options for adding a mention\r\n * to an activity\r\n */\r\nexport type AddMentionOptions = {\r\n /**\r\n * if `true`, append the mention `text` to the `activity.text`\r\n * @default true\r\n */\r\n readonly addText?: boolean;\r\n\r\n /**\r\n * the `text` to use for the mention\r\n *\r\n * @default `account.name`\r\n * @remark\r\n * this text should not include `<at>` or `</at>`\r\n */\r\n readonly text?: string;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/activities/message/message.ts"],"names":[],"mappings":";;;;AAmGO,MAAM,wBAAwB,QAAgD,CAAA;AAAA;AAAA;AAAA;AAAA,EAInF,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA,EAEA,WAAY,CAAA,IAAA,GAAe,EAAI,EAAA,KAAA,GAAiD,EAAI,EAAA;AAClF,IAAM,KAAA,CAAA;AAAA,MACJ,GAAG,KAAA;AAAA,MACH,IAAM,EAAA;AAAA,KACP,CAAA;AAED,IAAA,MAAA,CAAO,OAAO,IAAM,EAAA,EAAE,IAAM,EAAA,GAAG,OAAO,CAAA;AAAA;AACxC;AAAA;AAAA;AAAA,EAKA,OAAO,KAAK,QAA4B,EAAA;AACtC,IAAA,OAAO,IAAI,eAAA,CAAgB,QAAS,CA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,IAAA,IAAA,CAAK,YAAY,UAAa,GAAA,OAAA;AAE9B,IAAA,OAAO,KAAK,SAAU,CAAA;AAAA,MACpB,IAAM,EAAA,YAAA;AAAA,MACN,UAAU,IAAK,CAAA,EAAA;AAAA,MACf,UAAY,EAAA;AAAA,KACb,CAAA;AAAA;AAEL","file":"message.mjs","sourcesContent":["import {\n Account,\n Attachment,\n AttachmentLayout,\n cardAttachment,\n CardAttachmentType,\n CardAttachmentTypes,\n DeliveryMode,\n Importance,\n InputHint,\n MentionEntity,\n SuggestedActions,\n TextFormat,\n} from '../../models';\nimport { IActivity, Activity } from '../activity';\nimport { stripMentionsText, StripMentionsTextOptions } from '../utils';\n\nexport interface IMessageActivity extends IActivity<'message'> {\n /**\n * The text content of the message.\n */\n text: string;\n\n /**\n * The text to speak.\n */\n speak?: string;\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n inputHint?: InputHint;\n\n /**\n * The text to display if the channel cannot render cards.\n */\n summary?: string;\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n textFormat?: TextFormat;\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n attachmentLayout?: AttachmentLayout;\n\n /**\n * Attachments\n */\n attachments?: Attachment[];\n\n /**\n * The suggested actions for the activity.\n */\n suggestedActions?: SuggestedActions;\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n importance?: Importance;\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n deliveryMode?: DeliveryMode;\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n expiration?: Date;\n\n /**\n * A value that is associated with the activity.\n */\n value?: any;\n\n /**\n * remove \"\\<at>...\\</at>\" text from an activity\n */\n stripMentionsText(options?: StripMentionsTextOptions): IMessageActivity;\n\n /**\n * is the recipient account mentioned\n */\n isRecipientMentioned(): boolean;\n\n /**\n * get a mention by the account id if exists\n */\n getAccountMention(accountId: string): MentionEntity | undefined;\n}\n\nexport class MessageActivity extends Activity<'message'> implements IMessageActivity {\n /**\n * The text content of the message.\n */\n text!: string;\n\n /**\n * The text to speak.\n */\n speak?: string;\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n inputHint?: InputHint;\n\n /**\n * The text to display if the channel cannot render cards.\n */\n summary?: string;\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n textFormat?: TextFormat;\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n attachmentLayout?: AttachmentLayout;\n\n /**\n * Attachments\n */\n attachments?: Attachment[];\n\n /**\n * The suggested actions for the activity.\n */\n suggestedActions?: SuggestedActions;\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n importance?: Importance;\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n deliveryMode?: DeliveryMode;\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n expiration?: Date;\n\n /**\n * A value that is associated with the activity.\n */\n value?: any;\n\n constructor(text: string = '', value: Omit<Partial<IMessageActivity>, 'type'> = {}) {\n super({\n ...value,\n type: 'message',\n });\n\n Object.assign(this, { text, ...value });\n }\n\n /**\n * initialize from interface\n */\n static from(activity: IMessageActivity) {\n return new MessageActivity(activity.text, activity);\n }\n\n /**\n * convert to interface\n */\n toInterface(): IMessageActivity {\n return Object.assign(\n {\n stripMentionsText: this.stripMentionsText.bind(this),\n isRecipientMentioned: this.isRecipientMentioned.bind(this),\n getAccountMention: this.getAccountMention.bind(this),\n },\n this\n );\n }\n\n /**\n * copy to a new instance\n */\n clone(options: Omit<Partial<IMessageActivity>, 'type'> = {}) {\n return new MessageActivity(this.text, {\n ...this.toInterface(),\n ...options,\n });\n }\n\n /**\n * The text content of the message.\n */\n withText(value: string) {\n this.text = value;\n return this;\n }\n\n /**\n * The text to speak.\n */\n withSpeak(value: string) {\n this.speak = value;\n return this;\n }\n\n /**\n * Indicates whether your bot is accepting,\n * expecting, or ignoring user input after the message is delivered to the client. Possible\n * values include: 'acceptingInput', 'ignoringInput', 'expectingInput'\n */\n withInputHint(value: InputHint) {\n this.inputHint = value;\n return this;\n }\n\n /**\n * The text to display if the channel cannot render cards.\n */\n withSummary(value: string) {\n this.summary = value;\n return this;\n }\n\n /**\n * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'\n */\n withTextFormat(value: TextFormat) {\n this.textFormat = value;\n return this;\n }\n\n /**\n * The layout hint for multiple attachments. Default: list. Possible values include: 'list',\n * 'carousel'\n */\n withAttachmentLayout(value: AttachmentLayout) {\n this.attachmentLayout = value;\n return this;\n }\n\n /**\n * The suggested actions for the activity.\n */\n withSuggestedActions(value: SuggestedActions) {\n this.suggestedActions = value;\n return this;\n }\n\n /**\n * The importance of the activity. Possible values include: 'low', 'normal', 'high'\n */\n withImportance(value: Importance) {\n this.importance = value;\n return this;\n }\n\n /**\n * A delivery hint to signal to the recipient alternate delivery paths for the activity.\n * The default delivery mode is \"default\". Possible values include: 'normal', 'notification'\n */\n withDeliveryMode(value: DeliveryMode) {\n this.deliveryMode = value;\n return this;\n }\n\n /**\n * The time at which the activity should be considered to be \"expired\" and should not be\n * presented to the recipient.\n */\n withExpiration(value: Date) {\n this.expiration = value;\n return this;\n }\n\n /**\n * Append text\n */\n addText(text: string) {\n this.text += text;\n return this;\n }\n\n /**\n * Attachments\n */\n addAttachments(...value: Attachment[]) {\n if (!this.attachments) {\n this.attachments = [];\n }\n\n this.attachments.push(...value);\n return this;\n }\n\n /**\n * `@mention` an account\n * @param account the account to mention\n * @param options options to customize the mention\n */\n addMention(account: Account, options: AddMentionOptions = {}) {\n const text = options.text || account.name;\n const addText = options.addText || true;\n\n if (addText) {\n this.addText(`<at>${text}</at>`);\n }\n\n return this.addEntity({\n type: 'mention',\n mentioned: account,\n text: `<at>${text}</at>`,\n });\n }\n\n /**\n * Add a card attachment\n */\n addCard<T extends CardAttachmentType>(type: T, content: CardAttachmentTypes[T]['content']) {\n return this.addAttachments(cardAttachment(type, content));\n }\n\n /**\n * remove \"\\<at>...\\</at>\" text from an activity\n */\n stripMentionsText(options: StripMentionsTextOptions = {}) {\n this.text = stripMentionsText(this, options);\n return this;\n }\n\n /**\n * is the recipient account mentioned\n */\n isRecipientMentioned() {\n return (this.entities || [])\n .filter((e) => e.type === 'mention')\n .some((e) => e.mentioned.id === this.recipient.id);\n }\n\n /**\n * get a mention by the account id if exists\n */\n getAccountMention(accountId: string) {\n return (this.entities || [])\n .filter((e) => e.type === 'mention')\n .find((e) => e.mentioned.id === accountId);\n }\n\n /**\n * Add stream info, making\n * this a final stream message\n */\n addStreamFinal() {\n if (!this.channelData) {\n this.channelData = {};\n }\n\n this.channelData.streamId = this.id;\n this.channelData.streamType = 'final';\n\n return this.addEntity({\n type: 'streaminfo',\n streamId: this.id,\n streamType: 'final',\n });\n }\n}\n\n/**\n * options for adding a mention\n * to an activity\n */\nexport type AddMentionOptions = {\n /**\n * if `true`, append the mention `text` to the `activity.text`\n * @default true\n */\n readonly addText?: boolean;\n\n /**\n * the `text` to use for the mention\n *\n * @default `account.name`\n * @remark\n * this text should not include `<at>` or `</at>`\n */\n readonly text?: string;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { S as StripMentionsTextOptions, s as stripMentionsText } from '../../message-BM7D0_tg.mjs';
|
|
2
|
-
export { t as toActivityParams } from '../../activity-
|
|
2
|
+
export { t as toActivityParams } from '../../activity-PjVFY4cx.mjs';
|
|
3
3
|
import '../../models/account.mjs';
|
|
4
4
|
import '../../models/role.mjs';
|
|
5
5
|
import '../../models/entity/mention-entity.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { S as StripMentionsTextOptions, s as stripMentionsText } from '../../message-BKfEV_tV.js';
|
|
2
|
-
export { t as toActivityParams } from '../../activity-
|
|
2
|
+
export { t as toActivityParams } from '../../activity-CTQ0yu7i.js';
|
|
3
3
|
import '../../models/account.js';
|
|
4
4
|
import '../../models/role.js';
|
|
5
5
|
import '../../models/entity/mention-entity.js';
|
|
@@ -9,7 +9,7 @@ function toActivityParams(activity) {
|
|
|
9
9
|
type: "message",
|
|
10
10
|
text: activity
|
|
11
11
|
};
|
|
12
|
-
} else if (teams_cards.
|
|
12
|
+
} else if (teams_cards.isAdaptiveCard(activity)) {
|
|
13
13
|
activity = new message.MessageActivity().addCard("adaptive", activity);
|
|
14
14
|
}
|
|
15
15
|
return activity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/activities/utils/to-activity-params.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../src/activities/utils/to-activity-params.ts"],"names":["isAdaptiveCard","MessageActivity"],"mappings":";;;;;AAYO,SAAS,iBAAiB,QAAwC,EAAA;AACvE,EAAI,IAAA,OAAO,aAAa,QAAU,EAAA;AAChC,IAAW,QAAA,GAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,IAAM,EAAA;AAAA,KACR;AAAA,GACF,MAAA,IAAWA,0BAAe,CAAA,QAAQ,CAAG,EAAA;AACnC,IAAA,QAAA,GAAW,IAAIC,uBAAA,EAAkB,CAAA,OAAA,CAAQ,YAAY,QAAQ,CAAA;AAAA;AAG/D,EAAO,OAAA,QAAA;AACT","file":"to-activity-params.js","sourcesContent":["import { isAdaptiveCard } from '@microsoft/teams.cards';\n\nimport { ActivityParams } from '../../clients';\nimport { ActivityLike } from '../../models';\nimport { MessageActivity } from '../message';\n\n/**\n * @hidden\n * @internal\n *\n * Transforms supported send types into a valid `ActivityParams` object\n */\nexport function toActivityParams(activity: ActivityLike): ActivityParams {\n if (typeof activity === 'string') {\n activity = {\n type: 'message',\n text: activity,\n };\n } else if (isAdaptiveCard(activity)) {\n activity = new MessageActivity().addCard('adaptive', activity);\n }\n\n return activity;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAdaptiveCard } from '@microsoft/teams.cards';
|
|
2
2
|
import { MessageActivity } from '../message';
|
|
3
3
|
|
|
4
4
|
function toActivityParams(activity) {
|
|
@@ -7,7 +7,7 @@ function toActivityParams(activity) {
|
|
|
7
7
|
type: "message",
|
|
8
8
|
text: activity
|
|
9
9
|
};
|
|
10
|
-
} else if (
|
|
10
|
+
} else if (isAdaptiveCard(activity)) {
|
|
11
11
|
activity = new MessageActivity().addCard("adaptive", activity);
|
|
12
12
|
}
|
|
13
13
|
return activity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/activities/utils/to-activity-params.ts"],"names":[],"mappings":";;;AAYO,SAAS,iBAAiB,QAAwC,EAAA;AACvE,EAAI,IAAA,OAAO,aAAa,QAAU,EAAA;AAChC,IAAW,QAAA,GAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,IAAM,EAAA;AAAA,KACR;AAAA,GACF,MAAA,IAAW,
|
|
1
|
+
{"version":3,"sources":["../../../src/activities/utils/to-activity-params.ts"],"names":[],"mappings":";;;AAYO,SAAS,iBAAiB,QAAwC,EAAA;AACvE,EAAI,IAAA,OAAO,aAAa,QAAU,EAAA;AAChC,IAAW,QAAA,GAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,IAAM,EAAA;AAAA,KACR;AAAA,GACF,MAAA,IAAW,cAAe,CAAA,QAAQ,CAAG,EAAA;AACnC,IAAA,QAAA,GAAW,IAAI,eAAA,EAAkB,CAAA,OAAA,CAAQ,YAAY,QAAQ,CAAA;AAAA;AAG/D,EAAO,OAAA,QAAA;AACT","file":"to-activity-params.mjs","sourcesContent":["import { isAdaptiveCard } from '@microsoft/teams.cards';\n\nimport { ActivityParams } from '../../clients';\nimport { ActivityLike } from '../../models';\nimport { MessageActivity } from '../message';\n\n/**\n * @hidden\n * @internal\n *\n * Transforms supported send types into a valid `ActivityParams` object\n */\nexport function toActivityParams(activity: ActivityLike): ActivityParams {\n if (typeof activity === 'string') {\n activity = {\n type: 'message',\n text: activity,\n };\n } else if (isAdaptiveCard(activity)) {\n activity = new MessageActivity().addCard('adaptive', activity);\n }\n\n return activity;\n}\n"]}
|
|
@@ -38,7 +38,7 @@ import './activities/invoke/adaptive-card/action.js';
|
|
|
38
38
|
import { $MessageActivity } from './activities/message/index.js';
|
|
39
39
|
import { ITraceActivity } from './activities/trace.js';
|
|
40
40
|
import { ITypingActivity } from './activities/typing.js';
|
|
41
|
-
import {
|
|
41
|
+
import { IAdaptiveCard } from '@microsoft/teams.cards';
|
|
42
42
|
import { Account } from './models/account.js';
|
|
43
43
|
import { Resource } from './models/resource.js';
|
|
44
44
|
import './activities/message/message-delete.js';
|
|
@@ -138,7 +138,7 @@ type MessagingExtensionAction = TaskModuleRequest & {
|
|
|
138
138
|
* represents anything that can be transformed
|
|
139
139
|
* into an activity in an automated way
|
|
140
140
|
*/
|
|
141
|
-
type ActivityLike = ActivityParams | string |
|
|
141
|
+
type ActivityLike = ActivityParams | string | IAdaptiveCard;
|
|
142
142
|
/**
|
|
143
143
|
* represents an activity that was sent
|
|
144
144
|
*/
|