chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@botpresshub/logger",
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"build": "bp add -y && bp build --minify false",
|
||||
"add:integrations": "echo 'no integrations to add'",
|
||||
"test": "vitest --run"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@botpress/client": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/common": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*",
|
||||
"@bpinternal/genenv": "0.0.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
export default new sdk.PluginDefinition({
|
||||
name: 'logger',
|
||||
version: '0.1.0',
|
||||
configuration: { schema: sdk.z.object({}) },
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as bp from '.botpress'
|
||||
|
||||
const plugin = new bp.Plugin({
|
||||
actions: {},
|
||||
})
|
||||
|
||||
const log = (...x: any[]): undefined => {
|
||||
console.info(...x)
|
||||
return
|
||||
}
|
||||
|
||||
plugin.on.beforeIncomingEvent('*', async (x) => log('before_incoming_event', { data: x.data }))
|
||||
plugin.on.beforeIncomingMessage('*', async (x) =>
|
||||
log('before_incoming_message', { data: x.data, user: x.user?.id, conversation: x.conversation?.id })
|
||||
)
|
||||
plugin.on.beforeOutgoingMessage('*', async (x) => log('before_outgoing_message', { data: x.data }))
|
||||
plugin.on.beforeOutgoingCallAction('*', async (x) => log('before_call_action', { data: x.data }))
|
||||
plugin.on.afterIncomingEvent('*', async (x) => log('after_incoming_event', { data: x.data }))
|
||||
plugin.on.afterIncomingMessage('*', async (x) =>
|
||||
log('after_incoming_message', { data: x.data, user: x.user?.id, conversation: x.conversation?.id })
|
||||
)
|
||||
plugin.on.afterOutgoingMessage('*', async (x) => log('after_outgoing_message', { data: x.data }))
|
||||
plugin.on.afterOutgoingCallAction('*', async (x) => log('after_call_action', { data: x.data }))
|
||||
plugin.on.beforeIncomingCallAction('*', async (x) => log('before_incoming_call_action', { data: x.data }))
|
||||
plugin.on.afterIncomingCallAction('*', async (x) => log('after_incoming_call_action', { data: x.data }))
|
||||
|
||||
export default plugin
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": [".botpress/**/*", "definitions/**/*", "src/**/*", "*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import config from '../../vitest.config'
|
||||
export default config
|
||||
Reference in New Issue
Block a user