@botpress/sdk 5.0.2 → 5.1.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 +5 -5
- package/dist/bot/implementation.d.ts +4 -1
- package/dist/bot/server/types.d.ts +3 -0
- package/dist/index.cjs +30 -34
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +41 -43
- package/dist/index.mjs.map +4 -4
- package/dist/integration/server/integration-logger.d.ts +15 -0
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/sdk@5.
|
|
2
|
+
> @botpress/sdk@5.1.1 build /home/runner/work/botpress/botpress/packages/sdk
|
|
3
3
|
> pnpm build:type && pnpm build:node && pnpm build:browser
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/sdk@5.
|
|
6
|
+
> @botpress/sdk@5.1.1 build:type /home/runner/work/botpress/botpress/packages/sdk
|
|
7
7
|
> tsc -p ./tsconfig.package.json --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/sdk@5.
|
|
10
|
+
> @botpress/sdk@5.1.1 build:node /home/runner/work/botpress/botpress/packages/sdk
|
|
11
11
|
> ts-node -T ./build.ts --node
|
|
12
12
|
|
|
13
13
|
Done
|
|
14
14
|
|
|
15
|
-
> @botpress/sdk@5.
|
|
15
|
+
> @botpress/sdk@5.1.1 build:browser /home/runner/work/botpress/botpress/packages/sdk
|
|
16
16
|
> ts-node -T ./build.ts --browser
|
|
17
17
|
|
|
18
|
-
(node:
|
|
18
|
+
(node:3165) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
|
|
19
19
|
(Use `node --trace-deprecation ...` to show where the warning was created)
|
|
20
20
|
Done
|
|
@@ -2,8 +2,9 @@ import type { Server } from 'node:http';
|
|
|
2
2
|
import { BasePlugin, PluginImplementation } from '../plugin';
|
|
3
3
|
import * as utils from '../utils';
|
|
4
4
|
import { BaseBot } from './common';
|
|
5
|
-
import { MessageHandlers, EventHandlers, StateExpiredHandlers, HookHandlers, WorkflowHandlers, MessageHandlersMap, EventHandlersMap, StateExpiredHandlersMap, HookHandlersMap, WorkflowHandlersMap, UnimplementedActionHandlers, InjectedBotHandlers } from './server';
|
|
5
|
+
import { MessageHandlers, EventHandlers, StateExpiredHandlers, HookHandlers, WorkflowHandlers, MessageHandlersMap, EventHandlersMap, StateExpiredHandlersMap, HookHandlersMap, WorkflowHandlersMap, UnimplementedActionHandlers, InjectedBotHandlers, RegisterHandler } from './server';
|
|
6
6
|
export type BotImplementationProps<TBot extends BaseBot = BaseBot, TPlugins extends Record<string, BasePlugin> = {}> = {
|
|
7
|
+
register?: RegisterHandler<TBot>;
|
|
7
8
|
actions: UnimplementedActionHandlers<TBot, TPlugins>;
|
|
8
9
|
plugins: {
|
|
9
10
|
[K in utils.types.StringKeys<TPlugins>]: PluginImplementation<TPlugins[K]>;
|
|
@@ -11,6 +12,7 @@ export type BotImplementationProps<TBot extends BaseBot = BaseBot, TPlugins exte
|
|
|
11
12
|
};
|
|
12
13
|
export declare class BotImplementation<TBot extends BaseBot = BaseBot, TPlugins extends Record<string, BasePlugin> = {}> implements InjectedBotHandlers<TBot> {
|
|
13
14
|
readonly props: BotImplementationProps<TBot, TPlugins>;
|
|
15
|
+
private _registerHandler;
|
|
14
16
|
private _actionHandlers;
|
|
15
17
|
private _messageHandlers;
|
|
16
18
|
private _eventHandlers;
|
|
@@ -20,6 +22,7 @@ export declare class BotImplementation<TBot extends BaseBot = BaseBot, TPlugins
|
|
|
20
22
|
private _plugins;
|
|
21
23
|
private _registerOrder;
|
|
22
24
|
constructor(props: BotImplementationProps<TBot, TPlugins>);
|
|
25
|
+
get registerHandler(): RegisterHandler<TBot> | undefined;
|
|
23
26
|
get actionHandlers(): InjectedBotHandlers<TBot>['actionHandlers'];
|
|
24
27
|
get messageHandlers(): InjectedBotHandlers<TBot>['messageHandlers'];
|
|
25
28
|
get eventHandlers(): InjectedBotHandlers<TBot>['eventHandlers'];
|
|
@@ -343,6 +343,7 @@ export type OrderedWorkflowHandlersMap<TBot extends common.BaseBot> = {
|
|
|
343
343
|
}[];
|
|
344
344
|
};
|
|
345
345
|
};
|
|
346
|
+
export type RegisterHandler<TBot extends common.BaseBot> = (props: CommonHandlerProps<TBot>) => Promise<void>;
|
|
346
347
|
/**
|
|
347
348
|
* Bot handlers without InjectedHandlerProps
|
|
348
349
|
*
|
|
@@ -351,6 +352,7 @@ export type OrderedWorkflowHandlersMap<TBot extends common.BaseBot> = {
|
|
|
351
352
|
* "*" is meant the user who registers an handler, not for the user who calls the handler
|
|
352
353
|
*/
|
|
353
354
|
export type BotHandlers<TBot extends common.BaseBot> = {
|
|
355
|
+
registerHandler?: RegisterHandler<TBot>;
|
|
354
356
|
actionHandlers: ActionHandlersMap<TBot>;
|
|
355
357
|
messageHandlers: MessageHandlersMap<TBot>;
|
|
356
358
|
eventHandlers: EventHandlersMap<TBot>;
|
|
@@ -360,6 +362,7 @@ export type BotHandlers<TBot extends common.BaseBot> = {
|
|
|
360
362
|
};
|
|
361
363
|
/** identical to BotHandlers, but contains the injected properties */
|
|
362
364
|
export type InjectedBotHandlers<TBot extends common.BaseBot> = {
|
|
365
|
+
registerHandler?: RegisterHandler<TBot>;
|
|
363
366
|
actionHandlers: ActionHandlers<TBot>;
|
|
364
367
|
messageHandlers: {
|
|
365
368
|
[TMessageName in utils.StringKeys<IncomingMessages<TBot>>]?: MessageHandlers<TBot>[TMessageName][];
|