@microsoft/agents-activity 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +22 -0
  2. package/dist/src/action/actionTypes.d.ts +25 -0
  3. package/dist/src/action/actionTypes.js +30 -0
  4. package/dist/src/action/actionTypes.js.map +1 -0
  5. package/dist/src/action/cardAction.d.ts +74 -0
  6. package/dist/src/action/cardAction.js +23 -0
  7. package/dist/src/action/cardAction.js.map +1 -0
  8. package/dist/src/action/semanticAction.d.ts +52 -0
  9. package/dist/src/action/semanticAction.js +19 -0
  10. package/dist/src/action/semanticAction.js.map +1 -0
  11. package/dist/src/action/semanticActionStateTypes.d.ts +17 -0
  12. package/dist/src/action/semanticActionStateTypes.js +22 -0
  13. package/dist/src/action/semanticActionStateTypes.js.map +1 -0
  14. package/dist/src/action/suggestedActions.d.ts +77 -0
  15. package/dist/src/action/suggestedActions.js +17 -0
  16. package/dist/src/action/suggestedActions.js.map +1 -0
  17. package/dist/src/activity.d.ts +811 -0
  18. package/dist/src/activity.js +264 -0
  19. package/dist/src/activity.js.map +1 -0
  20. package/dist/src/activityEventNames.d.ts +16 -0
  21. package/dist/src/activityEventNames.js +21 -0
  22. package/dist/src/activityEventNames.js.map +1 -0
  23. package/dist/src/activityImportance.d.ts +17 -0
  24. package/dist/src/activityImportance.js +22 -0
  25. package/dist/src/activityImportance.js.map +1 -0
  26. package/dist/src/activityTypes.d.ts +33 -0
  27. package/dist/src/activityTypes.js +58 -0
  28. package/dist/src/activityTypes.js.map +1 -0
  29. package/dist/src/attachment/attachment.d.ts +37 -0
  30. package/dist/src/attachment/attachment.js +19 -0
  31. package/dist/src/attachment/attachment.js.map +1 -0
  32. package/dist/src/attachment/attachmentLayoutTypes.d.ts +16 -0
  33. package/dist/src/attachment/attachmentLayoutTypes.js +21 -0
  34. package/dist/src/attachment/attachmentLayoutTypes.js.map +1 -0
  35. package/dist/src/callerIdConstants.d.ts +21 -0
  36. package/dist/src/callerIdConstants.js +25 -0
  37. package/dist/src/callerIdConstants.js.map +1 -0
  38. package/dist/src/conversation/channelAccount.d.ts +38 -0
  39. package/dist/src/conversation/channelAccount.js +20 -0
  40. package/dist/src/conversation/channelAccount.js.map +1 -0
  41. package/dist/src/conversation/channels.d.ts +28 -0
  42. package/dist/src/conversation/channels.js +33 -0
  43. package/dist/src/conversation/channels.js.map +1 -0
  44. package/dist/src/conversation/conversationAccount.d.ts +50 -0
  45. package/dist/src/conversation/conversationAccount.js +23 -0
  46. package/dist/src/conversation/conversationAccount.js.map +1 -0
  47. package/dist/src/conversation/conversationReference.d.ts +152 -0
  48. package/dist/src/conversation/conversationReference.js +23 -0
  49. package/dist/src/conversation/conversationReference.js.map +1 -0
  50. package/dist/src/conversation/endOfConversationCodes.d.ts +20 -0
  51. package/dist/src/conversation/endOfConversationCodes.js +25 -0
  52. package/dist/src/conversation/endOfConversationCodes.js.map +1 -0
  53. package/dist/src/conversation/roleTypes.d.ts +17 -0
  54. package/dist/src/conversation/roleTypes.js +22 -0
  55. package/dist/src/conversation/roleTypes.js.map +1 -0
  56. package/dist/src/deliveryModes.d.ts +18 -0
  57. package/dist/src/deliveryModes.js +23 -0
  58. package/dist/src/deliveryModes.js.map +1 -0
  59. package/dist/src/entity/entity.d.ts +28 -0
  60. package/dist/src/entity/entity.js +15 -0
  61. package/dist/src/entity/entity.js.map +1 -0
  62. package/dist/src/entity/geoCoordinates.d.ts +29 -0
  63. package/dist/src/entity/geoCoordinates.js +7 -0
  64. package/dist/src/entity/geoCoordinates.js.map +1 -0
  65. package/dist/src/entity/mention.d.ts +22 -0
  66. package/dist/src/entity/mention.js +7 -0
  67. package/dist/src/entity/mention.js.map +1 -0
  68. package/dist/src/entity/place.d.ts +29 -0
  69. package/dist/src/entity/place.js +7 -0
  70. package/dist/src/entity/place.js.map +1 -0
  71. package/dist/src/entity/thing.d.ts +17 -0
  72. package/dist/src/entity/thing.js +7 -0
  73. package/dist/src/entity/thing.js.map +1 -0
  74. package/dist/src/expectedReplies.d.ts +14 -0
  75. package/dist/src/expectedReplies.js +7 -0
  76. package/dist/src/expectedReplies.js.map +1 -0
  77. package/dist/src/index.d.ts +38 -0
  78. package/dist/src/index.js +57 -0
  79. package/dist/src/index.js.map +1 -0
  80. package/dist/src/inputHints.d.ts +17 -0
  81. package/dist/src/inputHints.js +22 -0
  82. package/dist/src/inputHints.js.map +1 -0
  83. package/dist/src/invoke/adaptiveCardInvokeAction.d.ts +45 -0
  84. package/dist/src/invoke/adaptiveCardInvokeAction.js +18 -0
  85. package/dist/src/invoke/adaptiveCardInvokeAction.js.map +1 -0
  86. package/dist/src/messageReaction.d.ts +25 -0
  87. package/dist/src/messageReaction.js +16 -0
  88. package/dist/src/messageReaction.js.map +1 -0
  89. package/dist/src/messageReactionTypes.d.ts +16 -0
  90. package/dist/src/messageReactionTypes.js +21 -0
  91. package/dist/src/messageReactionTypes.js.map +1 -0
  92. package/dist/src/textFormatTypes.d.ts +17 -0
  93. package/dist/src/textFormatTypes.js +22 -0
  94. package/dist/src/textFormatTypes.js.map +1 -0
  95. package/dist/src/textHighlight.d.ts +31 -0
  96. package/dist/src/textHighlight.js +16 -0
  97. package/dist/src/textHighlight.js.map +1 -0
  98. package/package.json +44 -0
  99. package/src/action/actionTypes.ts +28 -0
  100. package/src/action/cardAction.ts +59 -0
  101. package/src/action/semanticAction.ts +35 -0
  102. package/src/action/semanticActionStateTypes.ts +20 -0
  103. package/src/action/suggestedActions.ts +29 -0
  104. package/src/activity.ts +334 -0
  105. package/src/activityEventNames.ts +19 -0
  106. package/src/activityImportance.ts +20 -0
  107. package/src/activityTypes.ts +56 -0
  108. package/src/attachment/attachment.ts +28 -0
  109. package/src/attachment/attachmentLayoutTypes.ts +19 -0
  110. package/src/callerIdConstants.ts +22 -0
  111. package/src/conversation/channelAccount.ts +29 -0
  112. package/src/conversation/channels.ts +29 -0
  113. package/src/conversation/conversationAccount.ts +35 -0
  114. package/src/conversation/conversationReference.ts +34 -0
  115. package/src/conversation/endOfConversationCodes.ts +23 -0
  116. package/src/conversation/roleTypes.ts +20 -0
  117. package/src/deliveryModes.ts +21 -0
  118. package/src/entity/entity.ts +27 -0
  119. package/src/entity/geoCoordinates.ts +30 -0
  120. package/src/entity/mention.ts +24 -0
  121. package/src/entity/place.ts +30 -0
  122. package/src/entity/thing.ts +18 -0
  123. package/src/expectedReplies.ts +16 -0
  124. package/src/index.ts +44 -0
  125. package/src/inputHints.ts +20 -0
  126. package/src/invoke/adaptiveCardInvokeAction.ts +38 -0
  127. package/src/messageReaction.ts +24 -0
  128. package/src/messageReactionTypes.ts +19 -0
  129. package/src/textFormatTypes.ts +20 -0
  130. package/src/textHighlight.ts +28 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+ import { Entity, entityZodSchema } from '../entity/entity'
8
+ import { SemanticActionStateTypes, semanticActionStateTypesZodSchema } from './semanticActionStateTypes'
9
+
10
+ /**
11
+ * Interface representing a semantic action.
12
+ */
13
+ export interface SemanticAction {
14
+ /**
15
+ * Unique identifier for the semantic action.
16
+ */
17
+ id: string
18
+ /**
19
+ * State of the semantic action.
20
+ */
21
+ state: SemanticActionStateTypes | string
22
+ /**
23
+ * Entities associated with the semantic action.
24
+ */
25
+ entities: { [propertyName: string]: Entity }
26
+ }
27
+
28
+ /**
29
+ * Zod schema for validating SemanticAction.
30
+ */
31
+ export const semanticActionZodSchema = z.object({
32
+ id: z.string().min(1),
33
+ state: z.union([semanticActionStateTypesZodSchema, z.string().min(1)]),
34
+ entities: z.record(entityZodSchema)
35
+ })
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Enum representing the state types of a semantic action.
10
+ */
11
+ export enum SemanticActionStateTypes {
12
+ Start = 'start',
13
+ Continue = 'continue',
14
+ Done = 'done',
15
+ }
16
+
17
+ /**
18
+ * Zod schema for validating SemanticActionStateTypes.
19
+ */
20
+ export const semanticActionStateTypesZodSchema = z.enum(['start', 'continue', 'done'])
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+ import { CardAction, cardActionZodSchema } from './cardAction'
8
+
9
+ /**
10
+ * Interface representing suggested actions.
11
+ */
12
+ export interface SuggestedActions {
13
+ /**
14
+ * Array of recipient IDs.
15
+ */
16
+ to: string[]
17
+ /**
18
+ * Array of card actions.
19
+ */
20
+ actions: CardAction[]
21
+ }
22
+
23
+ /**
24
+ * Zod schema for validating SuggestedActions.
25
+ */
26
+ export const suggestedActionsZodSchema = z.object({
27
+ to: z.array(z.string().min(1)),
28
+ actions: z.array(cardActionZodSchema)
29
+ })
@@ -0,0 +1,334 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+ import { v4 as uuid } from 'uuid'
8
+ import { ActivityTypes, activityTypesZodSchema } from './activityTypes'
9
+ import { SuggestedActions, suggestedActionsZodSchema } from './action/suggestedActions'
10
+ import { ActivityEventNames, activityEventNamesZodSchema } from './activityEventNames'
11
+ import { ActivityImportance, activityImportanceZodSchema } from './activityImportance'
12
+ import { TextHighlight, textHighlightZodSchema } from './textHighlight'
13
+ import { SemanticAction, semanticActionZodSchema } from './action/semanticAction'
14
+ import { ChannelAccount, channelAccountZodSchema } from './conversation/channelAccount'
15
+ import { ConversationAccount, conversationAccountZodSchema } from './conversation/conversationAccount'
16
+ import { TextFormatTypes, textFormatTypesZodSchema } from './textFormatTypes'
17
+ import { AttachmentLayoutTypes, attachmentLayoutTypesZodSchema } from './attachment/attachmentLayoutTypes'
18
+ import { MessageReaction, messageReactionZodSchema } from './messageReaction'
19
+ import { InputHints, inputHintsZodSchema } from './inputHints'
20
+ import { Attachment, attachmentZodSchema } from './attachment/attachment'
21
+ import { Entity, entityZodSchema } from './entity/entity'
22
+ import { ConversationReference, conversationReferenceZodSchema } from './conversation/conversationReference'
23
+ import { EndOfConversationCodes, endOfConversationCodesZodSchema } from './conversation/endOfConversationCodes'
24
+ import { DeliveryModes, deliveryModesZodSchema } from './deliveryModes'
25
+ import { Channels } from './conversation/channels'
26
+ import { Mention } from './entity/mention'
27
+
28
+ /**
29
+ * Zod schema for validating an Activity object.
30
+ */
31
+ export const activityZodSchema = z.object({
32
+ type: z.union([activityTypesZodSchema, z.string().min(1)]),
33
+ text: z.string().min(1).optional(),
34
+ id: z.string().min(1).optional(),
35
+ channelId: z.string().min(1).optional(),
36
+ from: channelAccountZodSchema.optional(),
37
+ timestamp: z.union([z.string().min(1).datetime().optional(), z.string().min(1).transform(s => new Date(s)).optional()]),
38
+ localTimestamp: z.string().min(1).transform(s => new Date(s)).optional(),
39
+ localTimezone: z.string().min(1).optional(),
40
+ callerId: z.string().min(1).optional(),
41
+ serviceUrl: z.string().min(1).optional(),
42
+ conversation: conversationAccountZodSchema.optional(),
43
+ recipient: channelAccountZodSchema.optional(),
44
+ textFormat: z.union([textFormatTypesZodSchema, z.string().min(1)]).optional(),
45
+ attachmentLayout: z.union([attachmentLayoutTypesZodSchema, z.string().min(1)]).optional(),
46
+ membersAdded: z.array(channelAccountZodSchema).optional(),
47
+ membersRemoved: z.array(channelAccountZodSchema).optional(),
48
+ reactionsAdded: z.array(messageReactionZodSchema).optional(),
49
+ reactionsRemoved: z.array(messageReactionZodSchema).optional(),
50
+ topicName: z.string().min(1).optional(),
51
+ historyDisclosed: z.boolean().optional(),
52
+ locale: z.string().min(1).optional(),
53
+ speak: z.string().min(1).optional(),
54
+ inputHint: z.union([inputHintsZodSchema, z.string().min(1)]).optional(),
55
+ summary: z.string().min(1).optional(),
56
+ suggestedActions: suggestedActionsZodSchema.optional(),
57
+ attachments: z.array(attachmentZodSchema).optional(),
58
+ entities: z.array(entityZodSchema).optional(),
59
+ channelData: z.any().optional(),
60
+ action: z.string().min(1).optional(),
61
+ replyToId: z.string().min(1).optional(),
62
+ label: z.string().min(1).optional(),
63
+ valueType: z.string().min(1).optional(),
64
+ value: z.unknown().optional(),
65
+ name: z.union([activityEventNamesZodSchema, z.string().min(1)]).optional(),
66
+ relatesTo: conversationReferenceZodSchema.optional(),
67
+ code: z.union([endOfConversationCodesZodSchema, z.string().min(1)]).optional(),
68
+ expiration: z.string().min(1).datetime().optional(),
69
+ importance: z.union([activityImportanceZodSchema, z.string().min(1)]).optional(),
70
+ deliveryMode: z.union([deliveryModesZodSchema, z.string().min(1)]).optional(),
71
+ listenFor: z.array(z.string().min(1)).optional(),
72
+ textHighlights: z.array(textHighlightZodSchema).optional(),
73
+ semanticAction: semanticActionZodSchema.optional()
74
+ })
75
+
76
+ /**
77
+ * Represents an activity in a conversation.
78
+ */
79
+ export class Activity {
80
+ type: ActivityTypes | string
81
+ text?: string
82
+ id?: string
83
+ channelId?: string
84
+ from?: ChannelAccount
85
+ timestamp?: Date | string
86
+ localTimestamp?: Date | string
87
+ localTimezone?: string
88
+ callerId?: string
89
+ serviceUrl?: string
90
+ conversation?: ConversationAccount
91
+ recipient?: ChannelAccount
92
+ textFormat?: TextFormatTypes | string
93
+ attachmentLayout?: AttachmentLayoutTypes | string
94
+ membersAdded?: ChannelAccount[]
95
+ membersRemoved?: ChannelAccount[]
96
+ reactionsAdded?: MessageReaction[]
97
+ reactionsRemoved?: MessageReaction[]
98
+ topicName?: string
99
+ historyDisclosed?: boolean
100
+ locale?: string
101
+ speak?: string
102
+ inputHint?: InputHints | string
103
+ summary?: string
104
+ suggestedActions?: SuggestedActions
105
+ attachments?: Attachment[]
106
+ entities?: Entity[]
107
+ channelData?: any
108
+ action?: string
109
+ replyToId?: string
110
+ label?: string
111
+ valueType?: string
112
+ value?: unknown
113
+ name?: ActivityEventNames | string
114
+ relatesTo?: ConversationReference
115
+ code?: EndOfConversationCodes | string
116
+ expiration?: string | Date
117
+ importance?: ActivityImportance | string
118
+ deliveryMode?: DeliveryModes | string
119
+ listenFor?: string[]
120
+ textHighlights?: TextHighlight[]
121
+ semanticAction?: SemanticAction
122
+ rawTimestamp?: string
123
+ rawExpiration?: string
124
+ rawLocalTimestamp?: string
125
+ [x: string]: unknown
126
+
127
+ /**
128
+ * Creates a new Activity instance.
129
+ * @param t The type of the activity.
130
+ * @throws Will throw an error if the activity type is invalid.
131
+ */
132
+ constructor (t: ActivityTypes | string) {
133
+ if (t === undefined) {
134
+ throw new Error('Invalid ActivityType: undefined')
135
+ }
136
+ if (t === null) {
137
+ throw new Error('Invalid ActivityType: null')
138
+ }
139
+ if ((typeof t === 'string') && (t.length === 0)) {
140
+ throw new Error('Invalid ActivityType: empty string')
141
+ }
142
+
143
+ this.type = t
144
+ }
145
+
146
+ /**
147
+ * Creates an Activity instance from a JSON string.
148
+ * @param json The JSON string representing the activity.
149
+ * @returns The created Activity instance.
150
+ */
151
+ static fromJson (json: string): Activity {
152
+ return this.fromObject(JSON.parse(json))
153
+ }
154
+
155
+ /**
156
+ * Creates an Activity instance from an object.
157
+ * @param o The object representing the activity.
158
+ * @returns The created Activity instance.
159
+ */
160
+ static fromObject (o: object): Activity {
161
+ const parsedActivity = activityZodSchema.passthrough().parse(o)
162
+ const activity = new Activity(parsedActivity.type)
163
+ Object.assign(activity, parsedActivity)
164
+ return activity
165
+ }
166
+
167
+ /**
168
+ * Creates a continuation activity from a conversation reference.
169
+ * @param reference The conversation reference.
170
+ * @returns The created continuation activity.
171
+ */
172
+ static getContinuationActivity (reference: ConversationReference): Activity {
173
+ const continuationActivityObj = {
174
+ type: ActivityTypes.Event,
175
+ name: ActivityEventNames.ContinueConversation,
176
+ id: uuid(),
177
+ channelId: reference.channelId,
178
+ locale: reference.locale,
179
+ serviceUrl: reference.serviceUrl,
180
+ conversation: reference.conversation,
181
+ recipient: reference.bot,
182
+ from: reference.user,
183
+ relatesTo: reference
184
+ }
185
+ const continuationActivity: Activity = Activity.fromObject(continuationActivityObj)
186
+ return continuationActivity
187
+ }
188
+
189
+ /**
190
+ * Gets the appropriate reply-to ID for the activity.
191
+ * @returns The reply-to ID, or undefined if not applicable.
192
+ */
193
+ private getAppropriateReplyToId (): string | undefined {
194
+ if (
195
+ this.type !== ActivityTypes.ConversationUpdate ||
196
+ (this.channelId !== Channels.Directline && this.channelId !== Channels.Webchat)
197
+ ) {
198
+ return this.id
199
+ }
200
+
201
+ return undefined
202
+ }
203
+
204
+ /**
205
+ * Gets the conversation reference for the activity.
206
+ * @returns The conversation reference.
207
+ * @throws Will throw an error if required properties are undefined.
208
+ */
209
+ public getConversationReference (): ConversationReference {
210
+ if (this.recipient === null || this.recipient === undefined) {
211
+ throw new Error('Activity Recipient undefined')
212
+ }
213
+ if (this.conversation === null || this.conversation === undefined) {
214
+ throw new Error('Activity Conversation undefined')
215
+ }
216
+ if (this.channelId === null || this.channelId === undefined) {
217
+ throw new Error('Activity ChannelId undefined')
218
+ }
219
+ if (this.serviceUrl === null || this.serviceUrl === undefined) {
220
+ throw new Error('Activity ServiceUrl undefined')
221
+ }
222
+
223
+ return {
224
+ activityId: this.getAppropriateReplyToId(),
225
+ user: this.from,
226
+ bot: this.recipient,
227
+ conversation: this.conversation,
228
+ channelId: this.channelId,
229
+ locale: this.locale,
230
+ serviceUrl: this.serviceUrl
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Applies a conversation reference to the activity.
236
+ * @param reference The conversation reference.
237
+ * @param isIncoming Whether the activity is incoming.
238
+ * @returns The updated activity.
239
+ */
240
+ public applyConversationReference (
241
+ reference: ConversationReference,
242
+ isIncoming = false
243
+ ): Activity {
244
+ this.channelId = reference.channelId
245
+ this.locale ??= reference.locale
246
+ this.serviceUrl = reference.serviceUrl
247
+ this.conversation = reference.conversation
248
+ if (isIncoming) {
249
+ this.from = reference.user
250
+ this.recipient = reference.bot ?? undefined
251
+ if (reference.activityId) {
252
+ this.id = reference.activityId
253
+ }
254
+ } else {
255
+ this.from = reference.bot ?? undefined
256
+ this.recipient = reference.user
257
+ if (reference.activityId) {
258
+ this.replyToId = reference.activityId
259
+ }
260
+ }
261
+
262
+ return this
263
+ }
264
+
265
+ public clone (): Activity {
266
+ const activityCopy = JSON.parse(JSON.stringify(this))
267
+
268
+ for (const key in activityCopy) {
269
+ if (typeof activityCopy[key] === 'string' && !isNaN(Date.parse(activityCopy[key]))) {
270
+ activityCopy[key] = new Date(activityCopy[key] as string)
271
+ }
272
+ }
273
+
274
+ Object.setPrototypeOf(activityCopy, Activity.prototype)
275
+ return activityCopy
276
+ }
277
+
278
+ /**
279
+ * Gets the mentions in the activity.
280
+ * @param activity The activity.
281
+ * @returns The list of mentions.
282
+ */
283
+ private getMentions (activity: Activity): Mention[] {
284
+ const result: Mention[] = []
285
+ if (activity.entities !== undefined) {
286
+ for (let i = 0; i < activity.entities.length; i++) {
287
+ if (activity.entities[i].type.toLowerCase() === 'mention') {
288
+ result.push(activity.entities[i] as unknown as Mention)
289
+ }
290
+ }
291
+ }
292
+ return result
293
+ }
294
+
295
+ /**
296
+ * Removes the mention text for a given ID.
297
+ * @param id The ID of the mention to remove.
298
+ * @returns The updated text.
299
+ */
300
+ private removeMentionText (id: string): string {
301
+ const mentions = this.getMentions(this)
302
+ const mentionsFiltered = mentions.filter((mention): boolean => mention.mentioned.id === id)
303
+ if ((mentionsFiltered.length > 0) && this.text) {
304
+ this.text = this.text.replace(mentionsFiltered[0].text, '').trim()
305
+ }
306
+ return this.text || ''
307
+ }
308
+
309
+ /**
310
+ * Removes the recipient mention from the activity text.
311
+ * @returns The updated text.
312
+ */
313
+ public removeRecipientMention (): string {
314
+ if ((this.recipient != null) && this.recipient.id) {
315
+ return this.removeMentionText(this.recipient.id)
316
+ }
317
+ return ''
318
+ }
319
+
320
+ /**
321
+ * Gets the conversation reference for a reply.
322
+ * @param replyId The ID of the reply.
323
+ * @returns The conversation reference.
324
+ */
325
+ public getReplyConversationReference (
326
+ replyId: string
327
+ ): ConversationReference {
328
+ const reference: ConversationReference = this.getConversationReference()
329
+
330
+ reference.activityId = replyId
331
+
332
+ return reference
333
+ }
334
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Enum representing activity event names.
10
+ */
11
+ export enum ActivityEventNames {
12
+ ContinueConversation = 'ContinueConversation',
13
+ CreateConversation = 'CreateConversation',
14
+ }
15
+
16
+ /**
17
+ * Zod schema for validating an ActivityEventNames enum.
18
+ */
19
+ export const activityEventNamesZodSchema = z.enum(['ContinueConversation', 'CreateConversation'])
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Enum representing activity importance levels.
10
+ */
11
+ export enum ActivityImportance {
12
+ Low = 'low',
13
+ Normal = 'normal',
14
+ High = 'high',
15
+ }
16
+
17
+ /**
18
+ * Zod schema for validating an ActivityImportance enum.
19
+ */
20
+ export const activityImportanceZodSchema = z.enum(['low', 'normal', 'high'])
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Enum representing activity types.
10
+ */
11
+ export enum ActivityTypes {
12
+ Message = 'message',
13
+ ContactRelationUpdate = 'contactRelationUpdate',
14
+ ConversationUpdate = 'conversationUpdate',
15
+ Typing = 'typing',
16
+ EndOfConversation = 'endOfConversation',
17
+ Event = 'event',
18
+ Invoke = 'invoke',
19
+ InvokeResponse = 'invokeResponse',
20
+ DeleteUserData = 'deleteUserData',
21
+ MessageUpdate = 'messageUpdate',
22
+ MessageDelete = 'messageDelete',
23
+ InstallationUpdate = 'installationUpdate',
24
+ MessageReaction = 'messageReaction',
25
+ Suggestion = 'suggestion',
26
+ Trace = 'trace',
27
+ Handoff = 'handoff',
28
+ Command = 'command',
29
+ CommandResult = 'commandResult',
30
+ Delay = 'delay'
31
+ }
32
+
33
+ /**
34
+ * Zod schema for validating an ActivityTypes enum.
35
+ */
36
+ export const activityTypesZodSchema = z.enum([
37
+ 'message',
38
+ 'contactRelationUpdate',
39
+ 'conversationUpdate',
40
+ 'typing',
41
+ 'endOfConversation',
42
+ 'event',
43
+ 'invoke',
44
+ 'invokeResponse',
45
+ 'deleteUserData',
46
+ 'messageUpdate',
47
+ 'messageDelete',
48
+ 'installationUpdate',
49
+ 'messageReaction',
50
+ 'suggestion',
51
+ 'trace',
52
+ 'handoff',
53
+ 'command',
54
+ 'commandResult',
55
+ 'delay'
56
+ ])
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Interface representing an attachment.
10
+ */
11
+ export interface Attachment {
12
+ contentType: string
13
+ contentUrl?: string
14
+ content?: unknown
15
+ name?: string
16
+ thumbnailUrl?: string
17
+ }
18
+
19
+ /**
20
+ * Zod schema for validating attachments.
21
+ */
22
+ export const attachmentZodSchema = z.object({
23
+ contentType: z.string().min(1),
24
+ contentUrl: z.string().min(1).optional(),
25
+ content: z.unknown().optional(),
26
+ name: z.string().min(1).optional(),
27
+ thumbnailUrl: z.string().min(1).optional()
28
+ })
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+
8
+ /**
9
+ * Enum representing the layout types for attachments.
10
+ */
11
+ export enum AttachmentLayoutTypes {
12
+ List = 'list',
13
+ Carousel = 'carousel',
14
+ }
15
+
16
+ /**
17
+ * Zod schema for validating attachment layout types.
18
+ */
19
+ export const attachmentLayoutTypesZodSchema = z.enum(['list', 'carousel'])
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Constants representing caller IDs.
8
+ */
9
+ export const CallerIdConstants = {
10
+ /**
11
+ * Public Azure channel caller ID.
12
+ */
13
+ PublicAzureChannel: 'urn:botframework:azure',
14
+ /**
15
+ * US Government channel caller ID.
16
+ */
17
+ USGovChannel: 'urn:botframework:azureusgov',
18
+ /**
19
+ * Bot-to-bot prefix for caller ID.
20
+ */
21
+ BotToBotPrefix: 'urn:botframework:aadappid:'
22
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+ import { roleTypeZodSchema, RoleTypes } from './roleTypes'
8
+
9
+ /**
10
+ * Interface representing a channel account.
11
+ */
12
+ export interface ChannelAccount {
13
+ id?: string
14
+ name?: string
15
+ aadObjectId?: string
16
+ role?: RoleTypes | string
17
+ properties?: unknown
18
+ }
19
+
20
+ /**
21
+ * Zod schema for validating a channel account.
22
+ */
23
+ export const channelAccountZodSchema = z.object({
24
+ id: z.string().min(1).optional(),
25
+ name: z.string().optional(),
26
+ aadObjectId: z.string().min(1).optional(),
27
+ role: z.union([roleTypeZodSchema, z.string().min(1)]).optional(),
28
+ properties: z.unknown().optional()
29
+ })
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Enum representing the different channels an agent can communicate through.
8
+ */
9
+ export enum Channels {
10
+ Alexa = 'alexa',
11
+ Console = 'console',
12
+ Directline = 'directline',
13
+ DirectlineSpeech = 'directlinespeech',
14
+ Email = 'email',
15
+ Emulator = 'emulator',
16
+ Facebook = 'facebook',
17
+ Groupme = 'groupme',
18
+ Line = 'line',
19
+ Msteams = 'msteams',
20
+ Omni = 'omnichannel',
21
+ Outlook = 'outlook',
22
+ Skype = 'skype',
23
+ Slack = 'slack',
24
+ Sms = 'sms',
25
+ Telegram = 'telegram',
26
+ Telephony = 'telephony',
27
+ Test = 'test',
28
+ Webchat = 'webchat',
29
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright(c) Microsoft Corporation.All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { z } from 'zod'
7
+ import { roleTypeZodSchema, RoleTypes } from './roleTypes'
8
+
9
+ /**
10
+ * Interface representing a conversation account.
11
+ */
12
+ export interface ConversationAccount {
13
+ id: string
14
+ conversationType?: string
15
+ tenantId?: string
16
+ isGroup?: boolean
17
+ name?: string
18
+ aadObjectId?: string
19
+ role?: RoleTypes | string
20
+ properties?: unknown
21
+ }
22
+
23
+ /**
24
+ * Zod schema for validating a conversation account.
25
+ */
26
+ export const conversationAccountZodSchema = z.object({
27
+ isGroup: z.boolean().optional(),
28
+ conversationType: z.string().min(1).optional(),
29
+ tenantId: z.string().min(1).optional(),
30
+ id: z.string().min(1),
31
+ name: z.string().min(1).optional(),
32
+ aadObjectId: z.string().min(1).optional(),
33
+ role: z.union([roleTypeZodSchema, z.string().min(1)]).optional(),
34
+ properties: z.unknown().optional()
35
+ })