@botpress/cli 1.7.3 → 2.0.1
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.
- package/.turbo/turbo-build.log +11 -9
- package/dist/api/bot-body.js +20 -6
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/client.js +18 -0
- package/dist/api/client.js.map +2 -2
- package/dist/api/interface-body.js.map +2 -2
- package/dist/api/plugin-body.js +79 -0
- package/dist/api/plugin-body.js.map +7 -0
- package/dist/api/types.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-implementation.js +40 -21
- package/dist/code-generation/bot-implementation/bot-implementation.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-plugins/index.js +76 -0
- package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +125 -0
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/index.js +27 -22
- package/dist/code-generation/bot-implementation/index.js.map +2 -2
- package/dist/code-generation/consts.js +3 -0
- package/dist/code-generation/consts.js.map +2 -2
- package/dist/code-generation/generators.js +8 -0
- package/dist/code-generation/generators.js.map +2 -2
- package/dist/code-generation/index.js +6 -0
- package/dist/code-generation/index.js.map +2 -2
- package/dist/code-generation/integration-package/index.js +11 -2
- package/dist/code-generation/integration-package/index.js.map +2 -2
- package/dist/code-generation/interface-implementation/index.js +29 -0
- package/dist/code-generation/interface-implementation/index.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/actions-module.js +84 -0
- package/dist/code-generation/interface-implementation/integration-typings/actions-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/channels-module.js +103 -0
- package/dist/code-generation/interface-implementation/integration-typings/channels-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/entities-module.js +59 -0
- package/dist/code-generation/interface-implementation/integration-typings/entities-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/events-module.js +59 -0
- package/dist/code-generation/interface-implementation/integration-typings/events-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/index.js +117 -0
- package/dist/code-generation/interface-implementation/integration-typings/index.js.map +7 -0
- package/dist/code-generation/interface-package/index.js +11 -2
- package/dist/code-generation/interface-package/index.js.map +2 -2
- package/dist/code-generation/module.js +17 -4
- package/dist/code-generation/module.js.map +2 -2
- package/dist/code-generation/plugin-implementation/index.js +56 -0
- package/dist/code-generation/plugin-implementation/index.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-implementation.js +86 -0
- package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js +84 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js +57 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js +59 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js +146 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js +60 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js.map +7 -0
- package/dist/code-generation/plugin-package/index.js +146 -0
- package/dist/code-generation/plugin-package/index.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +84 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js +52 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +62 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js +103 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js +62 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/typings.js +17 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/typings.js.map +7 -0
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-definitions.js +8 -0
- package/dist/command-definitions.js.map +2 -2
- package/dist/command-implementations/add-command.js +47 -10
- package/dist/command-implementations/add-command.js.map +2 -2
- package/dist/command-implementations/bundle-command.js +7 -2
- package/dist/command-implementations/bundle-command.js.map +2 -2
- package/dist/command-implementations/deploy-command.js +51 -0
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/gen-command.js +11 -0
- package/dist/command-implementations/gen-command.js.map +2 -2
- package/dist/command-implementations/index.js +8 -0
- package/dist/command-implementations/index.js.map +2 -2
- package/dist/command-implementations/init-command.js +36 -8
- package/dist/command-implementations/init-command.js.map +2 -2
- package/dist/command-implementations/lint-command.js +1 -1
- package/dist/command-implementations/lint-command.js.map +2 -2
- package/dist/command-implementations/plugin-commands.js +107 -0
- package/dist/command-implementations/plugin-commands.js.map +7 -0
- package/dist/command-implementations/project-command.js +30 -3
- package/dist/command-implementations/project-command.js.map +2 -2
- package/dist/command-implementations/read-command.js +13 -1
- package/dist/command-implementations/read-command.js.map +2 -2
- package/dist/config.js +23 -2
- package/dist/config.js.map +2 -2
- package/dist/consts.js +7 -0
- package/dist/consts.js.map +2 -2
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/index.js.map +2 -2
- package/dist/sdk/resolve-bot-interfaces.js +6 -1
- package/dist/sdk/resolve-bot-interfaces.js.map +2 -2
- package/dist/sdk/resolve-integration-interfaces.js +16 -8
- package/dist/sdk/resolve-integration-interfaces.js.map +2 -2
- package/dist/sdk/validate-bot.js +84 -0
- package/dist/sdk/validate-bot.js.map +7 -0
- package/dist/utils/esbuild-utils.js +3 -2
- package/dist/utils/esbuild-utils.js.map +2 -2
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +2 -2
- package/dist/utils/object-utils.js +32 -0
- package/dist/utils/object-utils.js.map +7 -0
- package/dist/utils/schema-utils.js.map +2 -2
- package/dist/utils/type-utils.js.map +1 -1
- package/e2e/tests/install-package.ts +1 -1
- package/package.json +3 -3
- package/templates/empty-bot/.botpress/implementation/index.ts +27 -18
- package/templates/empty-bot/.botpress/implementation/plugins/index.ts +11 -0
- package/templates/empty-bot/.botpress/index.ts +5 -1
- package/templates/empty-bot/package.json +2 -2
- package/templates/empty-integration/package.json +2 -2
- package/templates/empty-plugin/.botpress/implementation/index.ts +35 -0
- package/templates/empty-plugin/.botpress/implementation/typings/actions/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/empty-plugin/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/index.ts +26 -0
- package/templates/empty-plugin/.botpress/implementation/typings/integrations/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/interfaces/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/empty-plugin/.botpress/index.ts +1 -0
- package/templates/empty-plugin/package.json +16 -0
- package/templates/empty-plugin/plugin.definition.ts +7 -0
- package/templates/empty-plugin/src/index.ts +7 -0
- package/templates/empty-plugin/tsconfig.json +28 -0
- package/templates/hello-world/package.json +2 -2
- package/templates/webhook-message/package.json +2 -2
|
@@ -4,20 +4,41 @@
|
|
|
4
4
|
|
|
5
5
|
import * as sdk from "@botpress/sdk"
|
|
6
6
|
import * as typings from "./typings/index"
|
|
7
|
+
import * as plugins from "./plugins/index"
|
|
8
|
+
|
|
7
9
|
export * from "./typings/index"
|
|
10
|
+
export * from "./plugins/index"
|
|
8
11
|
|
|
12
|
+
type TPlugins = plugins.TPlugins
|
|
9
13
|
type TBot = sdk.DefaultBot<typings.TBot>
|
|
10
14
|
|
|
11
|
-
export
|
|
15
|
+
export type BotProps = {
|
|
16
|
+
actions: sdk.BotProps<TBot, TPlugins>["actions"]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class Bot extends sdk.Bot<TBot, TPlugins> {
|
|
20
|
+
public constructor(props: BotProps) {
|
|
21
|
+
super({
|
|
22
|
+
actions: props.actions,
|
|
23
|
+
plugins: plugins.plugins
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
|
|
13
28
|
// extra types
|
|
14
29
|
|
|
15
30
|
type AsyncFunction = (...args: any[]) => Promise<any>
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type
|
|
20
|
-
|
|
31
|
+
export type EventHandlers = Required<{
|
|
32
|
+
[K in keyof Bot['eventHandlers']]: NonNullable<Bot['eventHandlers'][K]>[number]
|
|
33
|
+
}>
|
|
34
|
+
export type MessageHandlers = Required<{
|
|
35
|
+
[K in keyof Bot['messageHandlers']]: NonNullable<Bot['messageHandlers'][K]>[number]
|
|
36
|
+
}>
|
|
37
|
+
|
|
38
|
+
export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]
|
|
39
|
+
export type EventHandlerProps = Parameters<EventHandlers['*']>[0]
|
|
40
|
+
|
|
41
|
+
export type Client = (MessageHandlerProps | EventHandlerProps)['client']
|
|
21
42
|
export type ClientOperation = keyof {
|
|
22
43
|
[K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null
|
|
23
44
|
}
|
|
@@ -26,16 +47,4 @@ export type ClientInputs = {
|
|
|
26
47
|
}
|
|
27
48
|
export type ClientOutputs = {
|
|
28
49
|
[K in ClientOperation]: Awaited<ReturnType<Client[K]>>
|
|
29
|
-
}
|
|
30
|
-
// @deprecated
|
|
31
|
-
export type BotEvent = EventHandlerProps['event']
|
|
32
|
-
// @deprecated
|
|
33
|
-
export type BotEvents = {
|
|
34
|
-
[K in BotEvent['type']]: Extract<BotEvent, { type: K }>
|
|
35
|
-
}
|
|
36
|
-
// @deprecated
|
|
37
|
-
export type BotState = ClientOutputs['getState']['state']
|
|
38
|
-
// @deprecated
|
|
39
|
-
export type BotStates = {
|
|
40
|
-
[K in BotState['name']]: Extract<BotState, { type: K }>['payload']
|
|
41
50
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// This file is generated. Do not edit it manually.
|
|
4
|
+
|
|
5
|
+
import * as sdk from "@botpress/sdk"
|
|
6
|
+
import * as typings from "./typings/index"
|
|
7
|
+
export * from "./typings/index"
|
|
8
|
+
|
|
9
|
+
type TPlugin = sdk.DefaultPlugin<typings.TPlugin>
|
|
10
|
+
|
|
11
|
+
export class Plugin extends sdk.Plugin<TPlugin> {}
|
|
12
|
+
|
|
13
|
+
// extra types
|
|
14
|
+
|
|
15
|
+
type AsyncFunction = (...args: any[]) => Promise<any>
|
|
16
|
+
export type EventHandlers = Required<{
|
|
17
|
+
[K in keyof Plugin['eventHandlers']]: NonNullable<Plugin['eventHandlers'][K]>[number]
|
|
18
|
+
}>
|
|
19
|
+
export type MessageHandlers = Required<{
|
|
20
|
+
[K in keyof Plugin['messageHandlers']]: NonNullable<Plugin['messageHandlers'][K]>[number]
|
|
21
|
+
}>
|
|
22
|
+
|
|
23
|
+
export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]
|
|
24
|
+
export type EventHandlerProps = Parameters<EventHandlers['*']>[0]
|
|
25
|
+
|
|
26
|
+
export type Client = (MessageHandlerProps | EventHandlerProps)['client']
|
|
27
|
+
export type ClientOperation = keyof {
|
|
28
|
+
[K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null
|
|
29
|
+
}
|
|
30
|
+
export type ClientInputs = {
|
|
31
|
+
[K in ClientOperation]: Parameters<Client[K]>[0]
|
|
32
|
+
}
|
|
33
|
+
export type ClientOutputs = {
|
|
34
|
+
[K in ClientOperation]: Awaited<ReturnType<Client[K]>>
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// This file is generated. Do not edit it manually.
|
|
4
|
+
|
|
5
|
+
import * as integrations from './integrations/index'
|
|
6
|
+
import * as interfaces from './interfaces/index'
|
|
7
|
+
import * as configuration from './configuration/index'
|
|
8
|
+
import * as events from './events'
|
|
9
|
+
import * as states from './states'
|
|
10
|
+
import * as actions from './actions'
|
|
11
|
+
|
|
12
|
+
export * as integrations from './integrations/index'
|
|
13
|
+
export * as interfaces from './interfaces/index'
|
|
14
|
+
export * as configuration from './configuration/index'
|
|
15
|
+
export * as events from './events/index'
|
|
16
|
+
export * as states from './states/index'
|
|
17
|
+
export * as actions from './actions'
|
|
18
|
+
|
|
19
|
+
export type TPlugin = {
|
|
20
|
+
integrations: integrations.Integrations
|
|
21
|
+
interfaces: interfaces.Interfaces
|
|
22
|
+
configuration: configuration.Configuration
|
|
23
|
+
events: events.Events
|
|
24
|
+
states: states.States
|
|
25
|
+
actions: actions.Actions
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './implementation'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bp-templates/empty-plugin",
|
|
3
|
+
"pluginName": "empty-plugin",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"check:type": "tsc --noEmit"
|
|
6
|
+
},
|
|
7
|
+
"private": true,
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@botpress/sdk": "2.0.1"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/node": "^18.11.17",
|
|
13
|
+
"ts-node": "^10.9.1",
|
|
14
|
+
"typescript": "^4.9.4"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["es2022"],
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"allowUnusedLabels": false,
|
|
11
|
+
"allowUnreachableCode": false,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"noImplicitOverride": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"target": "es2017",
|
|
18
|
+
"baseUrl": ".",
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"checkJs": false,
|
|
21
|
+
"incremental": true,
|
|
22
|
+
"exactOptionalPropertyTypes": false,
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
25
|
+
"noUnusedLocals": false
|
|
26
|
+
},
|
|
27
|
+
"include": [".botpress/**/*", "src/**/*", "./*.ts", "./*.json"]
|
|
28
|
+
}
|