chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
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.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {
|
||||
created: {
|
||||
schema: (args) =>
|
||||
z.object({
|
||||
item: withId(args.item),
|
||||
}),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
create: {
|
||||
input: {
|
||||
schema: (args) => z.object({ item: args.item }),
|
||||
},
|
||||
output: {
|
||||
schema: (args) => z.object({ item: withId(args.item) }),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user