@botpress/cli 3.5.0 → 3.5.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.
@@ -1,22 +1,22 @@
1
1
 
2
- > @botpress/cli@3.5.0 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@3.5.1 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@3.5.0 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@3.5.1 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@3.5.0 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@3.5.1 template:gen /home/runner/work/botpress/botpress/packages/cli
11
11
  > pnpm -r --stream -F @bp-templates/* exec bp gen
12
12
 
13
- šŸ¤– Botpress CLI v3.5.0
14
- šŸ¤– Botpress CLI v3.5.0
15
- šŸ¤– Botpress CLI v3.5.0
16
- šŸ¤– Botpress CLI v3.5.0
13
+ šŸ¤– Botpress CLI v3.5.1
14
+ šŸ¤– Botpress CLI v3.5.1
15
+ šŸ¤– Botpress CLI v3.5.1
16
+ šŸ¤– Botpress CLI v3.5.1
17
+ ā—‹ Generating typings for integration empty-integration...āœ“ Typings available at .botpress
17
18
  ā—‹ Generating typings for bot...āœ“ Typings available at .botpress
18
19
  ā—‹ Generating typings for integration hello-world...ā—‹ Generating typings for plugin empty-plugin...āœ“ Typings available at .botpress
19
20
  āœ“ Typings available at .botpress
20
- ā—‹ Generating typings for integration empty-integration...āœ“ Typings available at .botpress
21
- šŸ¤– Botpress CLI v3.5.0
21
+ šŸ¤– Botpress CLI v3.5.1
22
22
  ā—‹ Generating typings for integration webhook-message...āœ“ Typings available at .botpress
@@ -95,9 +95,18 @@ class BotImplementationModule extends import_module.Module {
95
95
  "export type MessageHandlers = Required<{",
96
96
  " [K in keyof BotHandlers['messageHandlers']]: NonNullable<BotHandlers['messageHandlers'][K]>[number]",
97
97
  "}>",
98
+ "export type WorkflowHandlers = {",
99
+ " [TWorkflowName in keyof Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>]:",
100
+ " Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>[TWorkflowName] extends",
101
+ " ({ handler: infer U })[] ? U : never",
102
+ "}",
98
103
  "",
99
104
  "export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]",
100
105
  "export type EventHandlerProps = Parameters<EventHandlers['*']>[0]",
106
+ "export type WorkflowHandlerProps = {",
107
+ " [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends",
108
+ " (..._: infer U) => any ? U[0] : never",
109
+ "}",
101
110
  "",
102
111
  "export type Client = (MessageHandlerProps | EventHandlerProps)['client']",
103
112
  "export type ClientOperation = keyof {",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/code-generation/bot-implementation/bot-implementation.ts"],
4
- "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { BotPluginsIndexModule } from './bot-plugins'\nimport { BotTypingsModule } from './bot-typings'\n\nexport class BotImplementationModule extends Module {\n private _typingsModule: BotTypingsModule\n private _pluginsModule: BotPluginsIndexModule\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Bot',\n path: consts.INDEX_FILE,\n })\n\n this._typingsModule = new BotTypingsModule(bot)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n\n this._pluginsModule = new BotPluginsIndexModule(bot)\n this._pluginsModule.unshift(consts.fromOutDir.pluginsDir)\n this.pushDep(this._pluginsModule)\n }\n\n public async getContent() {\n const {\n //\n _typingsModule: typingsModule,\n _pluginsModule: pluginsModule,\n } = this\n\n const typingsImport = typingsModule.import(this)\n const pluginsImport = pluginsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${typingsModule.name} from \"./${typingsImport}\"`,\n `import * as ${pluginsModule.name} from \"./${pluginsImport}\"`,\n '',\n `export * from \"./${typingsImport}\"`,\n `export * from \"./${pluginsImport}\"`,\n '',\n `type TPlugins = ${pluginsModule.name}.TPlugins`,\n `type TBot = sdk.DefaultBot<${typingsModule.name}.${typingsModule.exportName}>`,\n '',\n 'export type BotProps = {',\n ' actions: sdk.BotProps<TBot, TPlugins>[\"actions\"]',\n '}',\n '',\n 'export class Bot extends sdk.Bot<TBot, TPlugins> {',\n ' public constructor(props: BotProps) {',\n ' super({',\n ' actions: props.actions,',\n ` plugins: ${pluginsModule.name}.${pluginsModule.exportName}`,\n ' })',\n ' }',\n '}',\n '',\n '// extra types',\n '',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n '',\n 'export type BotHandlers = sdk.BotHandlers<TBot>',\n '',\n 'export type EventHandlers = Required<{',\n \" [K in keyof BotHandlers['eventHandlers']]: NonNullable<BotHandlers['eventHandlers'][K]>[number]\",\n '}>',\n 'export type MessageHandlers = Required<{',\n \" [K in keyof BotHandlers['messageHandlers']]: NonNullable<BotHandlers['messageHandlers'][K]>[number]\",\n '}>',\n '',\n \"export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]\",\n \"export type EventHandlerProps = Parameters<EventHandlers['*']>[0]\",\n '',\n \"export type Client = (MessageHandlerProps | EventHandlerProps)['client']\",\n 'export type ClientOperation = keyof {',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null',\n '}',\n 'export type ClientInputs = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientOutputs = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAu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,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { BotPluginsIndexModule } from './bot-plugins'\nimport { BotTypingsModule } from './bot-typings'\n\nexport class BotImplementationModule extends Module {\n private _typingsModule: BotTypingsModule\n private _pluginsModule: BotPluginsIndexModule\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Bot',\n path: consts.INDEX_FILE,\n })\n\n this._typingsModule = new BotTypingsModule(bot)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n\n this._pluginsModule = new BotPluginsIndexModule(bot)\n this._pluginsModule.unshift(consts.fromOutDir.pluginsDir)\n this.pushDep(this._pluginsModule)\n }\n\n public async getContent() {\n const {\n //\n _typingsModule: typingsModule,\n _pluginsModule: pluginsModule,\n } = this\n\n const typingsImport = typingsModule.import(this)\n const pluginsImport = pluginsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${typingsModule.name} from \"./${typingsImport}\"`,\n `import * as ${pluginsModule.name} from \"./${pluginsImport}\"`,\n '',\n `export * from \"./${typingsImport}\"`,\n `export * from \"./${pluginsImport}\"`,\n '',\n `type TPlugins = ${pluginsModule.name}.TPlugins`,\n `type TBot = sdk.DefaultBot<${typingsModule.name}.${typingsModule.exportName}>`,\n '',\n 'export type BotProps = {',\n ' actions: sdk.BotProps<TBot, TPlugins>[\"actions\"]',\n '}',\n '',\n 'export class Bot extends sdk.Bot<TBot, TPlugins> {',\n ' public constructor(props: BotProps) {',\n ' super({',\n ' actions: props.actions,',\n ` plugins: ${pluginsModule.name}.${pluginsModule.exportName}`,\n ' })',\n ' }',\n '}',\n '',\n '// extra types',\n '',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n '',\n 'export type BotHandlers = sdk.BotHandlers<TBot>',\n '',\n 'export type EventHandlers = Required<{',\n \" [K in keyof BotHandlers['eventHandlers']]: NonNullable<BotHandlers['eventHandlers'][K]>[number]\",\n '}>',\n 'export type MessageHandlers = Required<{',\n \" [K in keyof BotHandlers['messageHandlers']]: NonNullable<BotHandlers['messageHandlers'][K]>[number]\",\n '}>',\n 'export type WorkflowHandlers = {',\n \" [TWorkflowName in keyof Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>]:\",\n \" Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>[TWorkflowName] extends\",\n ' ({ handler: infer U })[] ? U : never',\n '}',\n '',\n \"export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]\",\n \"export type EventHandlerProps = Parameters<EventHandlers['*']>[0]\",\n 'export type WorkflowHandlerProps = {',\n ' [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends',\n ' (..._: infer U) => any ? U[0] : never',\n '}',\n '',\n \"export type Client = (MessageHandlerProps | EventHandlerProps)['client']\",\n 'export type ClientOperation = keyof {',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null',\n '}',\n 'export type ClientInputs = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientOutputs = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,yBAAsC;AACtC,yBAAiC;AAE1B,MAAM,gCAAgC,qBAAO;AAAA,EAC1C;AAAA,EACA;AAAA,EAED,YAAY,KAAwB;AACzC,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM,OAAO;AAAA,IACf,CAAC;AAED,SAAK,iBAAiB,IAAI,oCAAiB,GAAG;AAC9C,SAAK,eAAe,QAAQ,S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luginImplementationModule extends import_module.Module {
78
78
  " [K in keyof PluginHandlers['hookHandlers'][H]]: NonNullable<PluginHandlers['hookHandlers'][H][K]>[number]",
79
79
  " }>",
80
80
  "}>",
81
+ "export type WorkflowHandlers = {",
82
+ " [TWorkflowName in keyof Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>]:",
83
+ " Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>[TWorkflowName] extends",
84
+ " ({ handler: infer U })[] ? U : never",
85
+ "}",
81
86
  "",
82
87
  "export type AnyMessageHandler = MessageHandlers['*']",
83
88
  "export type AnyEventHandler = EventHandlers['*']",
@@ -92,6 +97,10 @@ class PluginImplementationModule extends import_module.Module {
92
97
  "export type HookHandlerProps = {",
93
98
  " [H in keyof AnyHookHanders]: Parameters<NonNullable<AnyHookHanders[H]>>[0]",
94
99
  "}",
100
+ "export type WorkflowHandlerProps = {",
101
+ " [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends",
102
+ " (..._: infer U) => any ? U[0] : never",
103
+ "}",
95
104
  "",
96
105
  "export type Client = (MessageHandlerProps | EventHandlerProps)['client']",
97
106
  "export type ClientOperation = keyof {",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/code-generation/plugin-implementation/plugin-implementation.ts"],
4
- "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { PluginTypingsModule } from './plugin-typings'\n\nexport class PluginImplementationModule extends Module {\n private _typingsModule: PluginTypingsModule\n\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Plugin',\n path: consts.INDEX_FILE,\n })\n\n this._typingsModule = new PluginTypingsModule(plugin)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n }\n\n public async getContent() {\n const typingsImport = this._typingsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `export * from \"./${typingsImport}\"`,\n '',\n `type TPlugin = sdk.DefaultPlugin<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n '',\n 'export class Plugin extends sdk.Plugin<TPlugin> {}',\n '',\n 'export type PluginProps = sdk.PluginProps<TPlugin>',\n 'export type PluginRuntimeProps = sdk.PluginRuntimeProps<TPlugin>',\n '',\n '// extra types',\n '',\n 'type ValueOf<T> = T[keyof T]',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n '',\n 'export type PluginHandlers = sdk.PluginHandlers<TPlugin>',\n '',\n 'export type EventHandlers = Required<{',\n \" [K in keyof PluginHandlers['eventHandlers']]: NonNullable<PluginHandlers['eventHandlers'][K]>[number]\",\n '}>',\n 'export type MessageHandlers = Required<{',\n \" [K in keyof PluginHandlers['messageHandlers']]: NonNullable<PluginHandlers['messageHandlers'][K]>[number]\",\n '}>',\n 'export type HookHandlers = Required<{',\n \" [H in keyof PluginHandlers['hookHandlers']]: Required<{\",\n \" [K in keyof PluginHandlers['hookHandlers'][H]]: NonNullable<PluginHandlers['hookHandlers'][H][K]>[number]\",\n ' }>',\n '}>',\n '',\n \"export type AnyMessageHandler = MessageHandlers['*']\",\n \"export type AnyEventHandler = EventHandlers['*']\",\n \"export type AnyActionHandler = ValueOf<PluginHandlers['actionHandlers']>\",\n 'export type AnyHookHanders = {',\n \" [H in keyof HookHandlers]: NonNullable<HookHandlers[H]['*']>\",\n '}',\n '',\n 'export type MessageHandlerProps = Parameters<AnyMessageHandler>[0]',\n 'export type EventHandlerProps = Parameters<AnyEventHandler>[0]',\n 'export type ActionHandlerProps = Parameters<AnyActionHandler>[0]',\n 'export type HookHandlerProps = {',\n ' [H in keyof AnyHookHanders]: Parameters<NonNullable<AnyHookHanders[H]>>[0]',\n '}',\n '',\n \"export type Client = (MessageHandlerProps | EventHandlerProps)['client']\",\n 'export type ClientOperation = keyof {',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null',\n '}',\n 'export type ClientInputs = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientOutputs = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,4BAAoC;AAE7B,MAAM,mCAAmC,qBAAO;AAAA,EAC7C;AAAA,EAED,YAAY,QAA8B;AAC/C,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM,OAAO;AAAA,IACf,CAAC;AAED,SAAK,iBAAiB,IAAI,0CAAoB,MAAM;AACpD,SAAK,eAAe,QAAQ,SAAS;AACrC,SAAK,QAAQ,KAAK,cAAc;AAAA,EAClC;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AAErD,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,oBAAoB;AAAA,MACpB;AAAA,MACA,oCAAoC,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MACpF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { PluginTypingsModule } from './plugin-typings'\n\nexport class PluginImplementationModule extends Module {\n private _typingsModule: PluginTypingsModule\n\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Plugin',\n path: consts.INDEX_FILE,\n })\n\n this._typingsModule = new PluginTypingsModule(plugin)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n }\n\n public async getContent() {\n const typingsImport = this._typingsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `export * from \"./${typingsImport}\"`,\n '',\n `type TPlugin = sdk.DefaultPlugin<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n '',\n 'export class Plugin extends sdk.Plugin<TPlugin> {}',\n '',\n 'export type PluginProps = sdk.PluginProps<TPlugin>',\n 'export type PluginRuntimeProps = sdk.PluginRuntimeProps<TPlugin>',\n '',\n '// extra types',\n '',\n 'type ValueOf<T> = T[keyof T]',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n '',\n 'export type PluginHandlers = sdk.PluginHandlers<TPlugin>',\n '',\n 'export type EventHandlers = Required<{',\n \" [K in keyof PluginHandlers['eventHandlers']]: NonNullable<PluginHandlers['eventHandlers'][K]>[number]\",\n '}>',\n 'export type MessageHandlers = Required<{',\n \" [K in keyof PluginHandlers['messageHandlers']]: NonNullable<PluginHandlers['messageHandlers'][K]>[number]\",\n '}>',\n 'export type HookHandlers = Required<{',\n \" [H in keyof PluginHandlers['hookHandlers']]: Required<{\",\n \" [K in keyof PluginHandlers['hookHandlers'][H]]: NonNullable<PluginHandlers['hookHandlers'][H][K]>[number]\",\n ' }>',\n '}>',\n 'export type WorkflowHandlers = {',\n \" [TWorkflowName in keyof Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>]:\",\n \" Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>[TWorkflowName] extends\",\n ' ({ handler: infer U })[] ? U : never',\n '}',\n '',\n \"export type AnyMessageHandler = MessageHandlers['*']\",\n \"export type AnyEventHandler = EventHandlers['*']\",\n \"export type AnyActionHandler = ValueOf<PluginHandlers['actionHandlers']>\",\n 'export type AnyHookHanders = {',\n \" [H in keyof HookHandlers]: NonNullable<HookHandlers[H]['*']>\",\n '}',\n '',\n 'export type MessageHandlerProps = Parameters<AnyMessageHandler>[0]',\n 'export type EventHandlerProps = Parameters<AnyEventHandler>[0]',\n 'export type ActionHandlerProps = Parameters<AnyActionHandler>[0]',\n 'export type HookHandlerProps = {',\n ' [H in keyof AnyHookHanders]: Parameters<NonNullable<AnyHookHanders[H]>>[0]',\n '}',\n 'export type WorkflowHandlerProps = {',\n ' [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends',\n ' (..._: infer U) => any ? U[0] : never',\n '}',\n '',\n \"export type Client = (MessageHandlerProps | EventHandlerProps)['client']\",\n 'export type ClientOperation = keyof {',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null',\n '}',\n 'export type ClientInputs = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientOutputs = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,4BAAoC;AAE7B,MAAM,mCAAmC,qBAAO;AAAA,EAC7C;AAAA,EAED,YAAY,QAA8B;AAC/C,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM,OAAO;AAAA,IACf,CAAC;AAED,SAAK,iBAAiB,IAAI,0CAAoB,MAAM;AACpD,SAAK,eAAe,QAAQ,SAAS;AACrC,SAAK,QAAQ,KAAK,cAAc;AAAA,EAClC;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AAErD,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,oBAAoB;AAAA,MACpB;AAAA,MACA,oCAAoC,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MACpF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run bundle && pnpm run template:gen",
@@ -22,7 +22,7 @@
22
22
  "@apidevtools/json-schema-ref-parser": "^11.7.0",
23
23
  "@botpress/chat": "0.5.1",
24
24
  "@botpress/client": "0.48.0",
25
- "@botpress/sdk": "3.5.0",
25
+ "@botpress/sdk": "3.5.1",
26
26
  "@bpinternal/const": "^0.1.0",
27
27
  "@bpinternal/tunnel": "^0.1.1",
28
28
  "@bpinternal/yargs-extra": "^0.0.3",
@@ -37,9 +37,18 @@ export type EventHandlers = Required<{
37
37
  export type MessageHandlers = Required<{
38
38
  [K in keyof BotHandlers['messageHandlers']]: NonNullable<BotHandlers['messageHandlers'][K]>[number]
39
39
  }>
40
+ export type WorkflowHandlers = {
41
+ [TWorkflowName in keyof Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>]:
42
+ Required<BotHandlers['workflowHandlers'][keyof BotHandlers['workflowHandlers']]>[TWorkflowName] extends
43
+ ({ handler: infer U })[] ? U : never
44
+ }
40
45
 
41
46
  export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]
42
47
  export type EventHandlerProps = Parameters<EventHandlers['*']>[0]
48
+ export type WorkflowHandlerProps = {
49
+ [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends
50
+ (..._: infer U) => any ? U[0] : never
51
+ }
43
52
 
44
53
  export type Client = (MessageHandlerProps | EventHandlerProps)['client']
45
54
  export type ClientOperation = keyof {
@@ -6,7 +6,7 @@
6
6
  "private": true,
7
7
  "dependencies": {
8
8
  "@botpress/client": "0.48.0",
9
- "@botpress/sdk": "3.5.0"
9
+ "@botpress/sdk": "3.5.1"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^18.19.67",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "0.48.0",
10
- "@botpress/sdk": "3.5.0"
10
+ "@botpress/sdk": "3.5.1"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^18.19.67",
@@ -31,6 +31,11 @@ export type HookHandlers = Required<{
31
31
  [K in keyof PluginHandlers['hookHandlers'][H]]: NonNullable<PluginHandlers['hookHandlers'][H][K]>[number]
32
32
  }>
33
33
  }>
34
+ export type WorkflowHandlers = {
35
+ [TWorkflowName in keyof Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>]:
36
+ Required<PluginHandlers['workflowHandlers'][keyof PluginHandlers['workflowHandlers']]>[TWorkflowName] extends
37
+ ({ handler: infer U })[] ? U : never
38
+ }
34
39
 
35
40
  export type AnyMessageHandler = MessageHandlers['*']
36
41
  export type AnyEventHandler = EventHandlers['*']
@@ -45,6 +50,10 @@ export type ActionHandlerProps = Parameters<AnyActionHandler>[0]
45
50
  export type HookHandlerProps = {
46
51
  [H in keyof AnyHookHanders]: Parameters<NonNullable<AnyHookHanders[H]>>[0]
47
52
  }
53
+ export type WorkflowHandlerProps = {
54
+ [TWorkflowName in keyof WorkflowHandlers]: WorkflowHandlers[TWorkflowName] extends
55
+ (..._: infer U) => any ? U[0] : never
56
+ }
48
57
 
49
58
  export type Client = (MessageHandlerProps | EventHandlerProps)['client']
50
59
  export type ClientOperation = keyof {
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/sdk": "3.5.0"
9
+ "@botpress/sdk": "3.5.1"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^18.19.67",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "0.48.0",
10
- "@botpress/sdk": "3.5.0"
10
+ "@botpress/sdk": "3.5.1"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^18.19.67",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "0.48.0",
10
- "@botpress/sdk": "3.5.0",
10
+ "@botpress/sdk": "3.5.1",
11
11
  "axios": "^1.6.8"
12
12
  },
13
13
  "devDependencies": {