chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
export const actions = {
|
||||
startDmConversation: {
|
||||
title: 'Start DM Conversation',
|
||||
description: 'Initiate a conversation with a user in a DM by email or user ID.',
|
||||
input: {
|
||||
schema: sdk.z.object({
|
||||
teamsUserId: sdk.z
|
||||
.string()
|
||||
.title('Teams User ID')
|
||||
.describe('The ID of any Teams user from tenant to initiate the conversation with, eg: "29:2d5f3..."')
|
||||
.optional(),
|
||||
teamsUserEmail: sdk.z
|
||||
.string()
|
||||
.title('Teams User Email')
|
||||
.describe('The Email of any Teams user from tenant to initiate the conversation with')
|
||||
.optional(),
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('Botpress Conversation ID')
|
||||
.describe('The ID of any Botpress conversation from channel "Teams", eg: "conv_01JZ..."'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: sdk.z.object({
|
||||
userId: sdk.z.string().title('User ID').describe('The ID of the user').optional(),
|
||||
conversationId: sdk.z.string().title('Conversation ID').describe('The ID of the new conversation'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
} as const satisfies sdk.IntegrationDefinitionProps['actions']
|
||||
@@ -0,0 +1,25 @@
|
||||
import { IntegrationDefinitionProps, messages } from '@botpress/sdk'
|
||||
|
||||
export const channels = {
|
||||
channel: {
|
||||
title: 'Channel',
|
||||
description: 'Teams conversation channel',
|
||||
messages: messages.defaults,
|
||||
message: {
|
||||
tags: {
|
||||
id: {
|
||||
title: 'ID',
|
||||
description: 'Teams activity ID',
|
||||
},
|
||||
},
|
||||
},
|
||||
conversation: {
|
||||
tags: {
|
||||
id: {
|
||||
title: 'ID',
|
||||
description: 'Teams conversation ID',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} satisfies IntegrationDefinitionProps['channels']
|
||||
@@ -0,0 +1,4 @@
|
||||
export { states } from './states'
|
||||
export { actions } from './actions'
|
||||
export { channels } from './channels'
|
||||
export { user } from './user'
|
||||
@@ -0,0 +1,36 @@
|
||||
import { z, IntegrationDefinitionProps } from '@botpress/sdk'
|
||||
import type { ConversationReference } from 'botbuilder'
|
||||
|
||||
// type testing utils
|
||||
type Is<A, B> = A extends B ? (B extends A ? true : false) : false
|
||||
type Expect<_T extends true> = void
|
||||
|
||||
export const channelAccountSchema = z.object({
|
||||
id: z.string().title('ID').describe('Account ID'),
|
||||
name: z.string().title('Name').describe('Account name'),
|
||||
})
|
||||
|
||||
const _convReferenceSchema = z.object({
|
||||
activityId: z.string().optional().title('Activity ID').describe('The activity ID'),
|
||||
user: channelAccountSchema.optional().title('User').describe('User account of the user conversing with the bot'),
|
||||
locale: z.string().optional().title('Locale').describe('The locale of the conversation'),
|
||||
bot: channelAccountSchema.title('Bot').describe('Bot account of the bot'),
|
||||
conversation: z.any().title('Conversation').describe('Conversation reference'), // botbuilder typings are deceiving
|
||||
channelId: z.string().title('Channel ID').describe('The channel ID of the conversation'),
|
||||
serviceUrl: z
|
||||
.string()
|
||||
.title('Service URL')
|
||||
.describe('Service endpoint where the operations concerning the conversation are performed'),
|
||||
})
|
||||
const _convReferenceStateSchema = _convReferenceSchema.partial()
|
||||
type ConvReferenceState = z.infer<typeof _convReferenceStateSchema>
|
||||
|
||||
// this builds only if the state schema is the same type as ConversationReference from 'botbuilder'
|
||||
type _Test = Expect<Is<ConvReferenceState, Partial<ConversationReference>>>
|
||||
|
||||
export const states = {
|
||||
conversation: {
|
||||
type: 'conversation',
|
||||
schema: _convReferenceStateSchema,
|
||||
},
|
||||
} satisfies IntegrationDefinitionProps['states']
|
||||
@@ -0,0 +1,14 @@
|
||||
import { IntegrationDefinitionProps } from '@botpress/sdk'
|
||||
|
||||
export const user = {
|
||||
tags: {
|
||||
id: {
|
||||
title: 'ID',
|
||||
description: 'Teams user ID',
|
||||
},
|
||||
email: {
|
||||
title: 'Email',
|
||||
description: 'Email address',
|
||||
},
|
||||
},
|
||||
} satisfies IntegrationDefinitionProps['user']
|
||||
Reference in New Issue
Block a user