Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integrations/messenger/src/channels/comment-replies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const commentReplies: bp.IntegrationProps['channels']['commentReplies'] = {
const { logger, conversation, payload, ctx, client, ack } = props
const { id } = conversation.tags

if (ctx.configurationType === 'sandbox') {
logger.forBot().error('Comment replies are not supported in sandbox mode')
return
}

if (!id) {
logger.forBot().error('Comment ID is required to reply to comments')
return
Expand Down
5 changes: 2 additions & 3 deletions interfaces/creatable/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* bplint-disable */
import { z, InterfaceDefinition } from '@botpress/sdk'

const baseItem = z.object({ id: z.string() })
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the creatable item') })
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)

export default new InterfaceDefinition({
name: 'creatable',
version: '0.0.2',
version: '0.0.3',
entities: {
item: {
schema: baseItem,
Expand Down
5 changes: 2 additions & 3 deletions interfaces/deletable/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* bplint-disable */
import { z, InterfaceDefinition } from '@botpress/sdk'

const baseItem = z.object({ id: z.string() })
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the deletable item') })

export default new InterfaceDefinition({
name: 'deletable',
version: '0.0.2',
version: '0.0.3',
entities: {
item: {
schema: baseItem,
Expand Down
30 changes: 19 additions & 11 deletions interfaces/files-readonly/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* bplint-disable */
import * as sdk from '@botpress/sdk'

const BASE_ITEM = (itemType: 'file' | 'folder' | 'item' = 'item') =>
Expand Down Expand Up @@ -63,6 +62,7 @@ export default new sdk.InterfaceDefinition({
sdk.z.object({
folderId: FOLDER.shape.id
.optional()
.title('Folder ID')
.describe('The folder ID to list the items from. Leave empty to list items from the root folder.'),
filters: sdk.z
.object({
Expand All @@ -75,19 +75,26 @@ export default new sdk.InterfaceDefinition({
.describe('Filter the items modified after the given date'),
})
.optional()
.title('Search Filters')
.describe('Optional search filters'),
nextToken: NEXT_TOKEN.describe(
nextToken: NEXT_TOKEN.title('Next Page Token').describe(
'The token to get the next page of items. Leave empty to get the first page.'
),
}),
},
output: {
schema: () =>
sdk.z.object({
items: sdk.z.array(sdk.z.union([FILE, FOLDER])).describe('The files and folders in the folder'),
meta: sdk.z.object({
nextToken: NEXT_TOKEN,
}),
items: sdk.z
.array(sdk.z.union([FILE, FOLDER]))
.title('Folder Items')
.describe('The files and folders in the folder'),
meta: sdk.z
.object({
nextToken: NEXT_TOKEN,
})
.title('Metadata')
.describe('List items in folder metadata'),
}),
},
},
Expand All @@ -112,7 +119,7 @@ export default new sdk.InterfaceDefinition({
output: {
schema: () =>
sdk.z.object({
botpressFileId: sdk.z.string().describe('The file ID of the uploaded file on Botpress'),
botpressFileId: sdk.z.string().title('File ID').describe('The file ID of the uploaded file on Botpress'),
}),
},
},
Expand All @@ -121,25 +128,25 @@ export default new sdk.InterfaceDefinition({
fileCreated: {
schema: () =>
sdk.z.object({
file: FILE_WITH_PATH.describe('The created file'),
file: FILE_WITH_PATH.title('Created File').describe('The created file'),
}),
},
fileUpdated: {
schema: () =>
sdk.z.object({
file: FILE_WITH_PATH.describe('The updated file'),
file: FILE_WITH_PATH.title('Updated File').describe('The updated file'),
}),
},
fileDeleted: {
schema: () =>
sdk.z.object({
file: FILE_WITH_PATH.describe('The deleted file'),
file: FILE_WITH_PATH.title('Deleted File').describe('The deleted file'),
}),
},
folderDeletedRecursive: {
schema: () =>
sdk.z.object({
folder: FOLDER_WITH_PATH.describe('The deleted folder'),
folder: FOLDER_WITH_PATH.title('Deleted Folder').describe('The deleted folder'),
}),
},
aggregateFileChanges: {
Expand All @@ -153,6 +160,7 @@ export default new sdk.InterfaceDefinition({
.array(sdk.z.union([FILE_WITH_PATH, FOLDER_WITH_PATH]))
.describe('The files and folders deleted'),
})
.title('Modified Items')
.describe('The modified items'),
}),
},
Expand Down
21 changes: 16 additions & 5 deletions interfaces/listable/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* bplint-disable */
import { z, InterfaceDefinition } from '@botpress/sdk'

const baseItem = z.object({ id: z.string() })
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the listable item') })
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)
const nextToken = z.string().optional()

export default new InterfaceDefinition({
name: 'listable',
version: '0.0.2',
version: '0.0.3',
entities: {
item: {
schema: baseItem,
Expand All @@ -17,13 +16,25 @@ export default new InterfaceDefinition({
actions: {
list: {
input: {
schema: () => z.object({ nextToken }),
schema: () =>
z.object({
nextToken: nextToken
.title('List Token')
.describe('The token to get a given list of items (e.g. a parent record ID, or a page index).'),
}),
},
output: {
schema: (args) =>
z.object({
items: z.array(withId(args.item)),
meta: z.object({ nextToken }),
meta: z
.object({
nextToken: nextToken
.title('List Token')
.describe('The token to get a given list of items (e.g. a parent record ID, or a page index).'),
})
.title('Metadata')
.describe('Metadata for the list operation'),
}),
},
},
Expand Down
3 changes: 1 addition & 2 deletions interfaces/llm/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* bplint-disable */
import * as common from '@botpress/common'
import { z, InterfaceDefinition } from '@botpress/sdk'

export default new InterfaceDefinition({
name: 'llm',
version: '9.0.0',
version: '9.0.1',
entities: {
modelRef: {
schema: common.llm.schemas.ModelRefSchema,
Expand Down
5 changes: 2 additions & 3 deletions interfaces/readable/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* bplint-disable */
import { z, InterfaceDefinition } from '@botpress/sdk'

const baseItem = z.object({ id: z.string() })
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the readable item') })
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)

export default new InterfaceDefinition({
name: 'readable',
version: '0.0.2',
version: '0.0.3',
entities: {
item: {
schema: baseItem,
Expand Down
3 changes: 1 addition & 2 deletions interfaces/speech-to-text/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* bplint-disable */
import * as common from '@botpress/common'
import { z, InterfaceDefinition } from '@botpress/sdk'

export default new InterfaceDefinition({
name: 'speech-to-text',
version: '2.0.1',
version: '2.0.2',
entities: {
speechToTextModelRef: {
schema: common.speechToText.schemas.SpeechModelRefSchema,
Expand Down
3 changes: 1 addition & 2 deletions interfaces/text-to-image/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* bplint-disable */
import * as common from '@botpress/common'
import { z, InterfaceDefinition } from '@botpress/sdk'

export default new InterfaceDefinition({
name: 'text-to-image',
version: '2.1.1',
version: '2.1.2',
entities: {
imageModelRef: {
schema: common.textToImage.schemas.ImageModelRefSchema,
Expand Down
24 changes: 18 additions & 6 deletions interfaces/typing-indicator/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* bplint-disable */
import * as sdk from '@botpress/sdk'

export default new sdk.InterfaceDefinition({
name: 'typing-indicator',
version: '0.0.3',
version: '0.0.4',
entities: {},
events: {},
actions: {
Expand All @@ -14,11 +13,18 @@ export default new sdk.InterfaceDefinition({
input: {
schema: () =>
sdk.z.object({
conversationId: sdk.z.string(),
messageId: sdk.z.string().describe('The message ID to which the typing indicator should be attached'),
conversationId: sdk.z
.string()
.title('Conversation ID')
.describe('The ID of the conversation where the typing indicator should be shown'),
messageId: sdk.z
.string()
.title('Message ID')
.describe('The message ID to which the typing indicator should be attached'),
timeout: sdk.z
.number()
.optional()
.title('Typing Indicator Timeout')
.describe('The timeout in milliseconds after which the typing indicator should stop'),
}),
},
Expand All @@ -33,8 +39,14 @@ export default new sdk.InterfaceDefinition({
input: {
schema: () =>
sdk.z.object({
conversationId: sdk.z.string(),
messageId: sdk.z.string().describe('The message ID from which the typing indicator should be removed'),
conversationId: sdk.z
.string()
.title('Conversation ID')
.describe('The ID of the conversation where the typing indicator should be removed'),
messageId: sdk.z
.string()
.title('Message ID')
.describe('The message ID from which the typing indicator should be removed'),
}),
},
output: {
Expand Down
5 changes: 2 additions & 3 deletions interfaces/updatable/interface.definition.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* bplint-disable */
import { z, InterfaceDefinition } from '@botpress/sdk'

const baseItem = z.object({ id: z.string() })
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the updatable item') })
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)

export default new InterfaceDefinition({
name: 'updatable',
version: '0.0.2',
version: '0.0.3',
entities: {
item: {
schema: baseItem,
Expand Down
90 changes: 0 additions & 90 deletions packages/cli/src/linter/ruleset-tests/interface.ruleset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,96 +882,6 @@ describeRule('legacy-zui-examples-should-be-removed', (lint) => {
})
})

describeRule('entities-should-have-a-title', (lint) => {
test('missing title should trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: {} },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(1)
expect(results[0]?.path).toEqual(['entities', ENTITY_NAME])
expect(results[0]?.message).toContain('title')
})

test('empty title should trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: { title: EMPTY_STRING } },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(1)
expect(results[0]?.path).toEqual(['entities', ENTITY_NAME, 'title'])
expect(results[0]?.message).toContain('title')
})

test('valid title should not trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: { title: TRUTHY_STRING } },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(0)
})
})

describeRule('entities-must-have-a-description', (lint) => {
test('missing description should trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: {} },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(1)
expect(results[0]?.path).toEqual(['entities', ENTITY_NAME])
expect(results[0]?.message).toContain('description')
})

test('empty description should trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: { description: EMPTY_STRING } },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(1)
expect(results[0]?.path).toEqual(['entities', ENTITY_NAME, 'description'])
expect(results[0]?.message).toContain('description')
})

test('valid description should not trigger', async () => {
// arrange
const definition = {
entities: { [ENTITY_NAME]: { description: TRUTHY_STRING } },
} as const satisfies PartialInterface

// act
const results = await lint(definition)

// assert
expect(results).toHaveLength(0)
})
})

describeRule('entity-fields-should-have-a-title', (lint) => {
test.each(PARAM_NAMES)('missing title should trigger (%s)', async (paramName) => {
// arrange
Expand Down
Loading
Loading